write a program for egyptian fractions in c?
Answer Posted / himaja
egyptian fraction is of the series eg 1/2+1/3=5/6.
#include<stdio.h>
#include<conio.h>
main()
{
int n,i=2,sum=0;
float m=0;
scanf("%d",&n);
for(i=0;i<=n;i++)
{
m = float(1/i);
sum=sum+m;
}
printf("%d",sum);
getch();
}
| Is This Answer Correct ? | 7 Yes | 8 No |
Post New Answer View All Answers
What is #line in c?
What is the difference between variable declaration and variable definition in c?
Explain the red-black trees?
Why we use break in c?
what is different between auto and local static? why should we use local static?
What is table lookup in c?
How do we make a global variable accessible across files? Explain the extern keyword?
What is 2 d array in c?
What are the different types of data structures in c?
How can I access an I o board directly?
What is floating point constants?
Is anything faster than c?
What is storage class?
Explain what math functions are available for integers? For floating point?
Why should I use standard library functions instead of writing my own?