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
What are the application of void data type in c?
Why C language is a procedural language?
What’s the special use of UNIONS?
What is restrict keyword in c?
What does char * * argv mean in c?
What is array in c with example?
how is the examination pattern?
How do you determine the length of a string value that was stored in a variable?
Why & is used in scanf in c?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What is difference between far and near pointers?
What is action and transformation in spark?
What is else if ladder?
Write a program of advanced Fibonacci series.
What is data type long in c?