compute the nth mumber in the fibonacci sequence?

Answer Posted / d. prashant

#include<stdio.h>
#include<conio.h>
void main()
{
int a =0,b=1,c,i=2,n;
clrscr();
printf("Enter N Value : ");
scanf("%d",&n);
printf("%d\t%d\t",a,b);
while(n>i)
{
c = a+b;
printf("%d\t",c);
c=b;
b=a;
i++;
}
getch();
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of using linked list for tree construction?

647


What are compound statements?

631


What is an auto keyword in c?

645


When is a null pointer used?

644


Does c have function or method?

596






Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1747


Difference between linking and loading?

697


What is the purpose of the statement: strcat (S2, S1)?

642


What is string concatenation in c?

570


What are the data types present in c?

631


What is floating point constants?

695


Explain the priority queues?

629


#include #include struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.

5215


Explain what is the heap?

624


Why is #define used?

792