View Code of Problem 30

#include<cstdio>
#include<cstdlib>
using namespace std;
int main(){
	
	int n,sum=0;
	while(scanf("%d",&n)==1){
		for(int i=1;i<=n;i++){
			sum+=i;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 30