public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int start = sc.nextInt();//开始的累加的数字
int end = sc.nextInt();//累加结束的数字
int i = start;
int sum = 0;//累加的和
while(i <= end){//循环累加
sum += start;
start++;
i++;
}
System.out.println(sum);
sc.close();
}
运行结果:

最后
以上就是纯真铃铛最近收集整理的关于数字累加的全部内容,更多相关数字累加内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复