import java.util.*;
class JPA301 {
public static void main(String argv[]) {
Scanner input = new Scanner(System.in);
System.out.println("Input:");
int n= input.nextInt();
int sum=0;
for (int i=1;i<=n;i++) {
sum=sum+i;
}
System.out.println("1+ ... + "+n+" = "+sum);
}
}
沒有留言:
張貼留言