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()) {
            long n = scanner.nextLong();
            long result=(n+1)*n/2;
            System.out.println(result);
        }
        
    }
}

Double click to view unformatted code.


Back to problem 30