Untitled

 avatar
unknown
java
a year ago
347 B
13
Indexable
import java.util.Scanner;

public class P1 {
	public static int Sol(int n) {
		int s = 0;
		int gt = 1;
		for (int i = 1; i <= n; i++)
		{
			gt *= i;
			s += gt;
		}

		return s;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		System.out.println(Sol(n));
	}
}
Editor is loading...
Leave a Comment