View Code of Problem 30

#include<stdio.h>
int main()
{
	int i, n,all;
	while (scanf("%d", &n) != EOF)
	{
		all = 0;
		if (n >=1)
		{
			for (i = 1; i <= n; i++)
				all += i;
		}
		printf("%d\n", all);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 30