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