compute the nth mumber in the fibonacci sequence?
Answer Posted / sree
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a=-1,b=1,c;
printf("Enter n:");
scanf("%d",&n);
for(int i=0;i<=n;i++)
{
c=a+b;
a=b;
b=c;
}
printf("Answer:%d",c);
}
Is This Answer Correct ? | 9 Yes | 6 No |
Post New Answer View All Answers
can we change the default calling convention in c if yes than how.........?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
What does *p++ do? What does it point to?
why programs in c are running with out #include
What is the difference between union and anonymous union?
How do I read the arrow keys? What about function keys?
What is the advantage of an array over individual variables?
Do pointers take up memory?
What does %c mean in c?
What will the preprocessor do for a program?
a c code by using memory allocation for add ,multiply of sprase matrixes
What is the size of enum in c?
how to find anagram without using string functions using only loops in c programming
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?