Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5.  
  6. int NWD(int a,int b)
  7. {
  8. int k;
  9. while(b!=0)
  10. {
  11. k=b;
  12. b=a%b;
  13. a=k;
  14.  
  15. }
  16. return a;
  17.  
  18. }
  19. int main()
  20. {
  21. int a,b;
  22. cout<<"Podaj liczby: ";
  23. cin>>a>>b;
  24. cout<<"NWD("<<a<<","<<b<<") = "<<NWD(a,b)<<endl;
  25. system("pause");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement