解决方法
解决方法
正在讨论
评论 (4)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
ohh
4 七月 2022, 15:29
int total = 0;
for (int i = 1; i <= 5; i++) {
total = total + i;
System.out.println(total);
}
0
狗子
22 十二月 2020, 02:55
好像还没学到for循环情况下的笨方法
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
System.out.println(a);
System.out.println(a+b);
System.out.println(a+b+c);
System.out.println(a+b+c+d);
System.out.println(a+b+c+d+e);
0
Bob
25 九月 2020, 09:54
public class Solution {
public static void main(String[] args) {
//在此编写你的代码
int x,y ;
for(x=0,y=1;y <= 5;y++){
x = x + y;
System.out.println(x);
}
}
}
0
mikejason
22 八月 2020, 18:13
int num = 0;
for(int i = 1;i <= 5;i++){
num = i + num;
System.out.println(num);
}
抛砖引玉,希望大神能指导,不胜感激。
0