Chintu is confusing himself with series of numbers. He has to find the sum of the following series. Your task is to write a code to find the sum of the following series 1+(1+2)+ (1+2+3)+ (1+2+3+4)++n Input: Input should contain the value of the limit n Output: It should print the Sum of series upto n limit Test Case 1 Input (stdin) 2 Expected Output Sum of series=4 Test Case 2 Input (stdin) 4 Expected Output Sum of series=20

#include <stdio.h>

int main(){

int n,sum,sum1=0,i,j;

scanf("%d",&n);

for(i=1;i<=n;i++){

sum=0;

for(j=1;j<=i;j++)

sum=sum+j;

sum1=sum1+sum;

}

printf("Sum of series=%d",sum1);

return 0;

}