compute the nth mumber in the fibonacci sequence?
Answer Posted / manish soni tagore collage jai
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum,n,cnt;
printf("Enter the number");
scanf("%d",&n);
for(a=0,b=1,cnt=1;cnt<=n;cnt++)
{
sum=a+b;
printf("%d\t",sum);
a=b;
b=sum;
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What does %c mean in c?
writ a program to compare using strcmp VIVA and viva with its output.
what will be the output for the following main() { printf("hi" "hello"); }
What are conditional operators in C?
Explain how can I remove the trailing spaces from a string?
What does node * mean?
How can I read/write structures from/to data files?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
Why doesnt long int work?
What is atoi and atof in c?
What is property type c?
Tell me with an example the self-referential structure?
What does != Mean in c?
Explain what are the advantages and disadvantages of a heap?
Explain indirection?