Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Entry.cpp : This file contains the 'main' function. Program execution begins and ends there.
- // Bài 1 | Huỳnh Thế Anh
- #include <iostream>
- using namespace std;
- void Fibo(int n)
- {
- int a=1,b = 1;
- while ( a+b < n )
- {
- cout << a << " " << b << " ";
- a = a + b;
- b = b + a;
- }
- if (a < n) cout << a << " ";
- if (b < n) cout << b << " ";
- }
- int main()
- {
- int n;
- cout << "n = " << endl;
- cin >> n;
- Fibo(n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement