recent

sum of series 1 to n

 series program in c
sum of following series in c
 1 + 2 + 3 + 4 + 5 + ... + n


#include<stdio.h>
int main()
{
    int j,n,sum=0;
    n=20;
    for(j=1;j<=n;j++)
    {
        sum+=j;
    }
    printf("Sum is: %d",sum);
}

Powered by Blogger.