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;
- while (b != 0)
- {
- c = a % b;
- a = b;
- b = c;
- }
- return a;
- }
- int main()
- {
- int a,b,c;
- cin>>a;
- for(int i = 0; i<a; i++)
- {
- cin>>b;
- cin>>c;
- cout<<nwd(b,c)<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement