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 came across some code that puts a (void) cast before each call to printf. Why?
Is void a keyword in c?
which is an algorithm for sorting in a growing Lexicographic order
What are nested functions in c?
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
Can we access the array using a pointer in c language?
Explain logical errors? Compare with syntax errors.
How to write a code for reverse of string without using string functions?
Write a program to use switch statement.
how to write optimum code to divide a 50 digit number with a 25 digit number??
What is maximum size of array in c?
Explain the use of fflush() function?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What is call by reference in functions?
In a byte, what is the maximum decimal number that you can accommodate?