Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int f1 = 1, f2 = 1;
  6.     int n, f3;
  7.     cin>>n;
  8.     for(int i = 3; i <= n; i++){
  9.         f3 = f1 + f2;
  10.         f1 = f2;
  11.         f2 = f3;
  12.     }
  13.     cout<<f3<<endl;
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement