SHARE
TWEET

Untitled

a guest Jun 26th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int fib_1 = 1, fib_2 = 1, ind = 2, A;
  8.     cin >> A;
  9.     while (fib_2 < A) {
  10.         int tmp = fib_2;
  11.         fib_2 += fib_1;
  12.         fib_1 = tmp;
  13.         ind++;
  14.     }
  15.     if (fib_2 == A)
  16.         cout << ind;
  17.     else
  18.         cout << -1;
  19.     system("pause");
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top