Advertisement
Guest User

odbyt

a guest
Apr 4th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int num, a;
  7.     cout<<"Podaj poczatkowa wartosc ciagu"<<endl;
  8.     cin>>a;
  9.     cout << "Podaj dlugosc ciagu : ";
  10.     cin >> num;
  11.  
  12.     int x = 0, y = a, z = 0;
  13.     for (int i = 0; i < num; i++) {
  14.         if (x != 0)
  15.         {
  16.         cout << x << endl;
  17.         }
  18.  
  19.         z = x + y;
  20.         x = y;
  21.         y = z;
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement