import java.util.Scanner;
public class Accumulate {
	public static void main(String[] arg) {
		Scanner inp = new Scanner(System.in);
		System.out.println("What number would you like to start from?");
		int i = inp.nextInt();

		int sum = summation(i); // Use this if you want to check task 1
		// int sum = summationSquare(i); // Use this if you want to check task 2 
											// make sure to uncomment by deleting the slashes 
											// and comment out the top
		System.out.println("The sum of all numbers from " + i + " is: " + sum);
	}

	// TASK 1
	public static int summation(int i) {
		int c = 1;
		int ans = 0;
		while (c <= i) {
			ans += c; // shorthand for ans = ans + i
			c++;
		}
		return ans;
	}

	// TASK 2
	public static int summationSquare(int i) {
		int c = 1;
		int ans = 0;
		while (c <= i) {
			ans += Math.pow(c, 2); // shorthand for ans = ans + i
			c++;
		}
		return ans;
	}
}