0 votes
158 views
in Programming by (98.9k points)
edited by
Write a C++ program to display a series of 20 terms of the Fibonacci series

1 Answer

0 votes
by (98.9k points)
selected
 
Best answer
#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();
}

Related questions

0 votes
1 answer 137 views
0 votes
1 answer 447 views
0 votes
1 answer 99 views
asked Jul 20, 2022 in C programming by Doubtly (98.9k points)

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

531 users

...