Read an integer n and print the sum of every whole number from 1 to n (inclusive).
Input / Output
Input: a single positive integer n. Output: the sum 1 + 2 + ... + n.
Examples
Input
5
Expected Output
15
Input
10
Expected Output
55
+ 2 hidden tests checked on Submit.
Main.java is the entry point. Add extra classes for OOP exercises — they compile together.
Run your code to see test results here.