Advertisement
BunchiePC

korki4

Dec 13th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <time.h>
  4. #include <math.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11.     int odp;
  12.     double tab[1000];
  13.     //napisz program, ktory spyta Cię, ktora liczbe Fibonacciego ma Ci podać
  14.     cout<<"Ktora liczbe Fib mam Ci podać?"<<endl;
  15.     cin>>odp;
  16.  
  17.     tab[0]=1;
  18.     tab[1]=1;
  19.  
  20.  
  21.     for(int i=2;i<=odp;i++)
  22.     {
  23.         tab[i]=tab[i-1]+tab[i-2];
  24.         cout<<tab[i]<<endl;
  25.  
  26.     }
  27.  
  28.     cout<<tab[odp];
  29.  
  30.  
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement