Advertisement Remove all ads

Write Program in C++ to Print First 20 Terms of Fibonacci Series (Series Is 0, 1, 1, 2, 3, 5, 8 .......... ) - Computer Science 1

Short Note

Write program in C++ to print first 20 terms of Fibonacci Series (Series is 0, 1, 1, 2, 3, 5, 8 .......... )

Advertisement Remove all ads

Solution

//Program to generate 20 terms of fibbonacci series 
#include <iostream.h>
void main()
{
  int f0, f1, f, n;
  f0 = 0;
  f1 = 1;

  cout <<"Fibbonacci Series :";
  cout << f0;
  cout << f1;
  for (n = 2; n < 20; n++)
  {
    f = f0 + f1;
    cout << f;
    f0 = f1;
    f1 = f;
  }
}​
Concept: C++ Programming
  Is there an error in this question or solution?
Advertisement Remove all ads

APPEARS IN

Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×