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
Why do we need constructors in c++?
What is a float in c++?
Is main a class in c++?
What is meant by entry controlled loop? What all C++ loops are exit controlled?
What is the difference between delegation and implemented-in-terms-of?
Explain how an exception handler is defined and invoked in a Program.
What can I safely assume about the initial values of variables which are not explicitly initialized?
Is it possible for a member function to delete the pointer, named this?
Is std :: string immutable?
Can constructor be private in c++?
What is java and c++?
What is the this pointer?
Why do we use using namespace std in c++?
Is arr and &arr are same expression for an array?
What is c++ library?