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 c,d;
- if(a>b)
- {
- c=a;
- a=b;
- b=c;
- }
- for(int i=1;i<=b;i++)
- {
- d=i;
- }
- return d;
- }
- int main()
- {
- int a,b;
- cout << "Najwiekszy wspolny dzielnik. Podaj liczbe naturalna a:" << endl;
- cin >> a;
- cout << "Podaj liczbe naturalna b:" << endl;
- cin >> b;
- cout << NWD(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement