fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int a,b,pom;
  8.  
  9. cout << "Podaj liczbe a: ";
  10.  
  11. cin >> b;
  12.  
  13. while (b!=0){
  14.  
  15. pom = a % b;
  16.  
  17. a = b;
  18.  
  19. b = pom;
  20.  
  21. }
  22.  
  23. cout << "Najwiekszy wspolny dzielnik: " << a << endl;
  24.  
  25. }
Success #stdin #stdout 0.01s 5644KB
stdin
50 67
stdout
Podaj liczbe a: Najwiekszy wspolny dzielnik: 2