How can I write a program to find the sum of the series given below:-
((1)/(2))+((3)/(4))+((5)/(6))+((7)/(8))+((9)/(10))......n
I have written a code but it is not giving the desired result...
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
float sum=0,i;
printf("Enter nthe term");
scanf("%d",&n);
for(i=0;i<n;i++)
{
sum=sum+((i+1)/(i+2));
}
printf("sum=%f",sum);
getch();
}
Please help...