public class Sun { public static void main(String[] args) { int num = 0; //累加器 int i = 1; while(i<=100){ //如果i小于等于100运行num + i num = num + i; i++; //i++ 每次加一 } System.out.println(num); //最后打印结果}}