Advertisement
borsha06

fibo.cpp

Sep 2nd, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int input,n,i,j,arr[100] = {0,1};
  6.     cin>>input;
  7.     for(i=2; i<=input;i++)
  8.     {
  9.         arr[i] = arr[i-1]+arr[i-2];
  10.  
  11.     }
  12.     cout<<arr[input];
  13.  
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement