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
How pointer is different from array?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
Why is extern used in c?
What is the purpose of 'register' keyword?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What is use of integral promotions in c?
Is null always equal to 0(zero)?
What is a program?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
Explain how do you declare an array that will hold more than 64kb of data?
how to execute a program using if else condition and the output should enter number and the number is odd only...
cavium networks written test pattern ..