View Code of Problem 30

#include <stdio.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int sum = 0;
		while(n > 0)
		{
			sum += n;
			n--;
		}
		printf("%d\n",sum);
	}
}

Double click to view unformatted code.


Back to problem 30