fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int nwd(int a, int b) {
  6. while (b != 0) {
  7. int pom =b;
  8. b= a%b;
  9. a=pom;
  10. }
  11. return a;
  12.  
  13. }
  14. int rzad(int goscie, int gospodarze) {
  15. return nwd (goscie,gospodarze);
  16. }
  17.  
  18. // testy
  19. int main() {
  20. cout << rzad(72, 90) << " " << rzad(24, 36) << endl;
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
18 12