public class Exp{
public static void main(String[] args){
int sum = 0;
for(int i = 1; i<=100; i++){
sum = sum +i;
}
System.out.println("s = " + sum);
}
}
public class Program {
public static void main(String[] args) {
Program p=new Program();
System.out.println(p.Sum(100));
}
public int Sum(int n){
if(n==1) return 1;
else return n+Sum(n-1); // 递归调用
}
}
int result=0;
for(int i=1;i++;i<=100){
result=i+result;
}
//打印syo.... result