代码如下:
public class SumDemo {
public static void main(String[] args) {
int sum = 0;
int x = 1;
while(x<100){
if(x%2==0){
sum=sum+x; x++;
}
}
System.out.println(sum);
}
代码如下:
public class SumDemo {
public static void main(String[] args) {
int sum = 0;
int x = 1;
while(x<100){
if(x%2==0){
sum=sum+x;
x++;
}
}
System.out.println(sum);
}
}这个程序对不对作者: @翱翔@ 时间: 2014-1-28 15:02
class SumDemo {
public static void main(String[] args) {
int sum = 0;
int x = 1;
while(x<100){
if(x%2==0){
sum=sum+x;
x++;
}
}
System.out.println(sum);
}