int sum = 0;
for(int i=1; i<=100; i++) {
if(i%2 != 0) {
sum = sum + i;
}
}
System.out.println(sum);
int sum = 0;
for(int i=1; i<=100; i=i+2) {
sum = sum + i;
}
}
System.out.println(sum);
int sum=0,i=1;
while(i<=100){
if(i%2!=0){
sum=sum+i;
}i++;}
System.out.println(sum);
你到代码 还是要什么