View Code of Problem 30

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

Double click to view unformatted code.


Back to problem 30