public class test { public static void main(String[] args) { int sum=0; for(int x=1;x<=100;x++){ sum=sum+x; } System.out.println(sum); } }结果为:5050