fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, firstNo = 0, secondNo = 1, theNo = 1;
  6. cin >> n;
  7. while (n > 1) {
  8. theNo = firstNo + secondNo;
  9. firstNo = secondNo;
  10. secondNo = theNo;
  11. --n;
  12. }
  13. cout << theNo;
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5292KB
stdin
7
stdout
13