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