Advertisement
Guest User

NWD

a guest
Feb 23rd, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. using namespace std;
  4. int a, b;
  5. int main()
  6. {
  7.     cout << "Podaj liczbe A:" << endl;
  8.     cin >> a;
  9.     cout << "Podaj liczbe B:" << endl;
  10.     cin >> b;
  11.    
  12.     while (a != b)
  13.     {
  14.         if (a > b)
  15.         {
  16.             a -= b;
  17.         }
  18.        
  19.         else
  20.         {
  21.             b -= a;
  22.         }
  23.     }
  24.     cout << "NWD tych liczb wynosi: " << a << endl;
  25.  
  26.     system("pause");
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement