StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 7. Program to generate the Fibonacci sequence.
Download
  1. C++ Programs list
6. Program to check whether a given number is positive or negative using the ternary operator. : 8. Program to find the factorial of a number using recursion.
C++ Programs list

1.      Program to generate the Fibonacci sequence.

  1. #include <iostream.h>

  2. #include<conio.h>

  3. int main() {

  4.     int n, t1 = 0, t2 = 1, nextTerm = 0;

  5.     cout << "Enter the number of terms: ";

  6.     cin >> n;

  7.     cout << "Fibonacci Series: ";

  8.     for (int i = 1; i <= n; ++i) {

  9.                 cout << t1 << " ";

  10.                 nextTerm = t1 + t2;

  11.                 t1 = t2;

  12.                 t2 = nextTerm;

  13.     }

  14.     getch();

  15.     return 0;

  16. }

  17.  

6. Program to check whether a given number is positive or negative using the ternary operator. 8. Program to find the factorial of a number using recursion.
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website