fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int NWD_dz(int a, int b)
  5. {
  6. while (a!=0 && b!=0)
  7. {if(a>0)
  8. a=a%b;
  9. else
  10. b=b%a;
  11. }
  12. if(a!=0)
  13. return a;
  14. else
  15. return b;
  16. }
  17. int main()
  18. {int a, b;
  19. cout<<"Podaj liczby a i b"<<endl;
  20. cin>>a>>b;
  21. cout<<"NWD_dz(a,b)"<<endl;
  22. }
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
Podaj liczby a i b
NWD_dz(a,b)