1+(1+2)+(1+2+3)+...

 avatar
user_3763047219
c_cpp
2 years ago
144 B
1
Indexable
Never
int main()
{
	int N = 0,sum=0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		sum = sum + (1 + i) * i / 2;
	}
	printf("%d", sum);
}