int sum=0;while(sum!=0);sum=(1+100)*50;
有三种方法:一. int sum = 0; for(int i = 1; i <= 100; i++) sum += i;二. int sum = 0,i = 1; while(1 <= 100){ sum += i; i++ }三. int sum = 0,int i = 1; do{ sum += i; i++; }while(i < 100);