Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int a = 1;
- int b = 1;
- int c = a + b;
- cout << a << endl << b << endl;
- while(c <= n) {
- cout << c << endl;
- a = b;
- b = c;
- c = a + b;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment