View Code of Problem 30

import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            Integer get = Integer.valueOf(scanner.nextLine());
            int sum = 0;
            for (int i = 1; i <= get; i++) {
                sum += i;
            }
            System.out.println(sum);
        }
    }


}

Double click to view unformatted code.


Back to problem 30