0 votes
195 views
in Programming by (245 points)
edited
Write program in C++ to display first 20 terms of Fibonacci Series

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

Code :


#include<iostream.h>

#include<conio.h>

void main()
{
int n1,n2,n,i;

clrscr();
n1=0;
n2=1;

cout<<"Fibonacci series :"<<endl;
cout<<n1<<endl;
cout<<n2<<endl;
for (i=3;i<=20;i++)
{
n=n1+n2;
cout<<n<<endl;
n1=n2;
n2=n;
}
getch();
}

Output::


image


Related questions

0 votes
1 answer 179 views
0 votes
1 answer 464 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

559 users

...