View Code of Problem 30

#include <stdio.h>
using namespace std;
int main(){
	int n;
	long long int sum=0;
	while(~scanf("%d", &n )){
		sum = 0;
		for( int i=1; i<=n;i++){
			 sum += i;	
		}
		printf("%lld\n", sum );
	}

	return 0;
	
}

Double click to view unformatted code.


Back to problem 30