write a program for egyptian fractions in c?
Answer / 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 |
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?
Disadvantages of C language.
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output?
#include<stdio.h> int main() { int a[3][3][2]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; printf("%d\n",*(*(*a+1)); return 0; } What will be the output of the above question? And how?
the expression a=30*1000+2768; evalutes to a) 32768 b) -32768 c) 113040 d) 0
How do I use strcmp?
What is the translation phases used in c language?
What is preprocessor with example?
Explain what are the different data types in c?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is the difference between exit() and _exit() function?
When should we use pointers in a c program?