compute the nth mumber in the fibonacci sequence?
Answer Posted / theredplanethavoc
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,n,i;
clrscr();
printf("Enter n:");
scanf("%d",&n);
printf("The fibonacci sequence is as follows : \n");
for(i=1;i<=n;i++)
{
c=a+b;
printf("%d ",c);
a=b;
b=c;
}
printf("The nth number in the fibonacci sequence is : %d",c);
getch();
}
| Is This Answer Correct ? | 25 Yes | 3 No |
Post New Answer View All Answers
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What are structural members?
What do you mean by command line argument?
Tell me the use of bit field in c language?
What are bitwise shift operators in c programming?
How arrays can be passed to a user defined function
Explain #pragma statements.
Explain how can you tell whether two strings are the same?
If the size of int data type is two bytes, what is the range of signed int data type?
Is stack a keyword in c?
How do you use a 'Local Block'?
Explain the use of function toupper() with and example code?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Why header file is used in c?