日期:2014-05-20 浏览次数:20828 次
public class test { public static void main(String[] args) { int s = 0; for (int i = 1; i <= 100; i++) { s = s + i; } System.out.println(s); } }
int X=1; int S=0; while(X<=100){ S+=X; X++; } System.out.println(S);