Advertisement
KingaGolas

zad17

Mar 29th, 2020
101
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.  
  3. using namespace std;
  4.  
  5. int NWD (int a, int b)
  6. {
  7. while (a != b)
  8. {
  9. if (a<b)
  10. {
  11. b -= a;
  12. }
  13. else
  14. {
  15. a -=b;
  16. }
  17. }
  18. cout << a;
  19. }
  20.  
  21. int main()
  22. {
  23. NWD (4,10);
  24. cout <<endl;
  25. NWD (3,9);
  26. cout <<endl;
  27. NWD (48,90);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement