//sum of series 1+1/3+1/5............1/n.
#include<stdio.h>
#include<conio.h>
void main ()
{ clrscr();
int n,i;
float a=3,sum=1.0;
printf("enter nth term :\n");
scanf("%d\n",&n);
for(i=1;i<n;i++)
{
sum+=1/a;
a=a+2;
}
printf("%f",sum);
getch();
}
//think simple ;)
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment