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)
- {
- while (a != b)
- {
- if (a<b)
- {
- b -= a;
- }
- else
- {
- a -=b;
- }
- }
- cout << a;
- }
- int main()
- {
- NWD (4,10);
- cout <<endl;
- NWD (3,9);
- cout <<endl;
- NWD (48,90);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement