1.1for循环
public static void main (String args[]){
int sum = 0;
for(int i=0;i<=100;i++ ) {
sum += i;
}
System.out.print("1到100总和时是="+sum);
}
1.2do while循环
public static void main(String[] args) {
int sum =0;
int i =0;
do{
sum +=i;
i++;
}while (i <= 100);
System.out.println("1到100总和是:" + sum);
}