Write the program for fibonacci in c++?

Answer Posted / abhilash

int main()
{
unsigned int i=0,j=0,sum=1,num;
printf("nEnter the limit for the series ");
scanf("%d",&num);
while(sum<num)
{
printf("%d ",sum);
i=j;
j=sum;
sum=i+j;

}


getch();
}

Is This Answer Correct ?    14 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a constant? Explain with an example.

563


What is the fastest c++ compiler?

589


What do you mean by overhead in c++?

583


State the difference between pre and post increment/decrement operations.

611


Is c++ the hardest language?

565






What return value must conversion operators have in their declaration?

619


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2297


What is constructor and destructor in c++?

621


If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?

618


What is a class template?

593


What is the difference between equal to (==) and assignment operator (=)?

581


When must you use a pointer rather than a reference?

608


What is the use of setprecision in c++?

550


What is abstraction c++?

593


How do you master coding?

569