Write the program for fibonacci in c++?
Answer Posted / srinivasan
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=0,b=1,c=0,n;
cout<<"Enter the number: ";
cin>>n;
cout<<a<<" "<<b<<" ";
for(int i=1;i<=n;i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<" ";
}
getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
How will you call C functions from C ++ and vice-versa?
What are the five basic elements of a c++ program?
What are the benefits of oop in c++?
What are abstract data types in c++?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
Can non graphic characters be used and processed in C++?
Why c++ is better than c language?
Which software is best for coding?
Do you know what is overriding?
What is the auto keyword good for in c++?
What are the operators in c++?
How many types of modularization are there in c++?
what are function pointers?
What is polymorphism and its type in c++?
What do you mean by enumerated data type?