public class HelloWorld{ public static void main(String[]args){ int i=1; int sum=0; for(;i<=10;i++){ if(i%2!=0){ continue; } sum=sum+i; } System.out.println("1
public class HelloWorld {
public static void main(String[] args) {
int sum = 0; // 保存累加值
int i = 1;
for (; i <= 10; i++) {
// 如果i为奇数,结束本次循环,进行下一次循环
if (i%2!=0) {
continue;
}
sum = sum + i;
}
System.out.print("1到10之间的所有偶数的和为:" + sum);
}
}
public class HelloWorld{ public static void main(String[]args){ int i=1; int sum=0; for(;i<=10;i++){ if(i%2!=0){ continue; } sum=sum+i; } System.out.println("1