Monday, June 24, 2019

find the program to find the sum of the given series upto n terms

#include <stdio.h>
#include <stdlib.h>


void main()
{
    int i, n, sum=0,term=1;
    printf ("Enter number of terms ") ;
    scanf ("%d" ,&n) ;
    for(i=1;i<=n;i++)
    {
        sum+=term;
        term=term+i;
    }
    printf ("The sum of series upto %d terms is %d\n", n, sum) ;
}

No comments:

Post a Comment

python class topic video