Series 07

Given a number of terms the task is to calculate the value upto ‘n’ terms of the below given series.

Series: 1⁄1 + 1⁄3 + 2⁄5 + 3⁄7 + 4⁄9 + …………… + ‘n’ terms

C
#include <stdio.h>
void main()
{
    int n=0;
    double result=0.0,c=1.0;
    printf("Enter number of terms: ");
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        result=result+(i/c);
        c=c+2; 
    }
    printf("Result of the series : %lf",result);
}
C