package homework; |
public class WhileSum { |
public static void main(String [] args) { |
int i= 1 ; |
int n= 100 ; |
int sum= 0 ; |
while (i<=n) { |
sum+=i; |
i++; |
} |
System.out.println( "1加到100的和是:" +sum); |
System.out.println( "循环后变量i的值是:" +i); |
} |
} |