public class HelloWorld {
public static void main(String[] args)
{
int sum = 0;
int num = 0;
do{
sum=nmu+sum;
num+2;
}
while(num<50);
System.out.println("五十以内偶数的和为:"+sum);
}
}
sum += num; num = num+2;
感觉多用“+=”不容易写错变量名(毕竟可以少写个单词)~
do里面改一下
sum=num+sum;
num+=2;
这样