123456789101112131415161718 |
- //Lauren
-
- import java.util.Scanner;
-
- public class Main {
-
- public static void main(String[] args){
- Scanner in = new Scanner(System.in);
- System.out.print("Please enter a positive whole number.");
- int n = in.nextInt();
- int total = 0;
- for (int i = 1 ; i <= n ; i++) {
- total = total + i;
- }
- System.out.print(total);
- }
- }
|