Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int NWD (int a, int b);
- int main()
- {
- int a, b;
- cout << "Podaj liczby" << endl;
- cin >>a>>b;
- cout<<NWD(a,b);
- return 0;
- }
- int NWD (int a, int b){
- int d;
- if(a>b){
- d=b;
- }
- else{
- d=a;
- }
- for(;a%d==0&&b%d==0;d--)
- return d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement