Pages

Sunday, 30 August 2015

Series 4

Number Series 4

Coding:

#include<stdio.h>

int main()
{
    int i,n;
    float term=1,sum=0,x;
    printf("Please enter the number of terms:");
    scanf("%d",&n);
    printf("Please enter the x:");
    scanf("%f",&x);
    for(i=1;i<=n;i++)
    {
        sum=sum+term;
        term=(term*x)/i;
    }
    printf("Result is:%f",sum);
    return 0;
}

Output:
Please enter the number of terms:5
Result is:2.283334