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
Tell me can the size of an array be declared at runtime?
Define Spanning-Tree Protocol (STP)
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
Which is better between malloc and calloc?
What is the difference between the = symbol and == symbol?
What does c mean?
When should structures be passed by values or by references?
What is the correct code to have following output in c using nested for loop?
Is c is a high level language?
What is actual argument?
What is call by reference in functions?
Explain what is the difference between the expression '++a' and 'a++'?
Can you subtract pointers from each other? Why would you?
What is advantage of pointer in c?
how to capitalise first letter of each word in a given string?