Advertisement
fiqriachmada

Fibonacci Matematika Diskrit

Jun 16th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5. long int y,n;char in;
  6. bool state=true;
  7.  
  8. int main()
  9. {
  10.     while(state){
  11.     long int x=1,y,i,j,k;
  12.     long int a=0,b=1,c;
  13.  
  14.     cout<<" n = ";
  15.     cin>>y;
  16.  
  17.     cout<<a;
  18.     for(i=0; i<=y-1; i++){
  19.             c=a+b; b=a; a=c;
  20.             if(i>=x-1)
  21.             {
  22.                 cout<<" ";
  23.                 cout<<" "<<c;
  24.                 cout<<" ";
  25.             }
  26.         }
  27.         cout<<endl;
  28.        }
  29.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement