Write the program for fibonacci in c++?

Answer Posted / jitendra goyal

#include<stdio.h>
#include<conio.h>
main()
{
int a=0,b=1,n,c;
printf("how many element you want in series");
scanf("%d",&n);
printf("%d%d",a,b);
for(i=0;i<=n-2;i++)
{
c=a+b;
print("%d",c);
a=b;
b=c;
}
getch();
}

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen if a pointer is deleted twice?

718


Show the declaration for a static member variable.

522


Write a program which uses functions like strcmp(), strcpy()? etc

612


Why c++ is called oop?

593


Tell me can a pure virtual function have an implementation?

551






What is the use of ::(scope resolution operator)?

644


Should I learn c or c++ or c#?

555


What is implicit conversion/coercion in c++?

645


What is a lambda function c++?

549


Explain function overloading

583


When you overload member functions, in what ways must they differ?

586


What are the various operations performed on stack?

627


What is the use of string in c++?

545


What are guid? Why does com need guids?

566


Write about the various sections of the executable image?

570