Created
August 10, 2017 17:18
-
-
Save echo-akash/8e96b3a3acb67e63d2ffd1e752d3011f to your computer and use it in GitHub Desktop.
Print the sum of the series: 1*2 + 2*3 + ....... + N*(N+1) = ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int i,n,s; | |
s=0; | |
printf("enter the range:"); | |
scanf("%d",&n); | |
for(i=1;i<=n;i++) | |
{ | |
printf("(%d*%d)",i,i+1); | |
if(i==n) | |
printf("="); | |
else | |
printf("+"); | |
s=s+(i*(i+1)); | |
} | |
printf("%d",s); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment