Fibonacci Series in C++ - 👑 सार्थक मुंड S3 🤴🏻

Fibonacci Series in C++

Fibonacci Series in C++

Write a program (WAP) in C++ to calculate Fibonacci Series of a numbers.

#include <iostream>
using namespace std;
int main()
{
    int a = 0, b = 1, NT = 0, n;
// NT=Next Term
    cout << "Enter a positive number : \n";
    cin >> n;
   
// displays the first two terms which is always 0 and 1
    cout << "Fibonacci Series is : " << a << ", " << b << ", ";
    NT = a + b;
    while(NT <= n)
    {
        cout << NT << ", ";
        a = b;
        b = NT;
        NT = a + b;
    }
    return 0;
}

Out Put :-

Fibonacci Series in C++

Must Read :-
  1. Blogger Tutorial
  2. C Programs
  3. C++ Programs
  4. Java Programs
  5. Python Programs
  6. Programming Notes 
  7. Questions & Answers
  8. My Codes : HTML, CSS & JS
  9. All Subject Notes
Previous article
Next article

Leave Comments

Post a Comment

Articles Ads

Articles Ads 1

Articles Ads 2

Advertisement Ads