Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a = 0;
  6. int b = 0;
  7. cout << "Podaj wartosc a: " << endl;
  8. cin >> a;
  9. cout << "Podaj wartosc b: " << endl;
  10. cin >> b;
  11. do
  12. {
  13. if (a > b)
  14. {
  15. a = a - b;
  16.  
  17. }
  18. else
  19. {
  20. b = b - a;
  21. }
  22.  
  23.  
  24.  
  25. } while (a != b);
  26.  
  27. cout << "Najwiekszy wspolny dzielnik: " << a << endl;
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement