fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. long long f[100];
  6. int n;
  7.  
  8. int main(){
  9. f[0] = 0;
  10. f[1] = 1;
  11. cin >> n;
  12. for(int i = 2; i <= n; i++){
  13. f[i] = f[i-1] + f[i-2];
  14. }
  15. cout << f[n];
  16. }
  17.  
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty