Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define double long double
- #define pb push_back
- int GCD(int a , int b){
- while(a && b){
- if(a > b)
- a %= b;
- else
- b %= a;
- }
- return a + b;
- }
- int gcd(int a , int b){
- if(!a || !b)
- return a + b;
- return gcd(b , a % b);
- }
- signed main()
- {
- int a , b;
- cin >> a >> b;
- cout << gcd(a , b) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement