- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgcd.cpp
More file actions
Latest commit
19 lines (18 loc) · 371 Bytes
/
Copy pathgcd.cpp
File metadata and controls
19 lines (18 loc) · 371 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Online C++ compiler to run C++ program online
#include<bits/stdc++.h>
usingnamespacestd;
intgcd(int a, int b) {
// if(!a)
// return b;
// if(!b)
// return a;
// if(a < b)
// return gcd(a, b - a);
// return gcd(b - a, a);
if(b == 0)
return a;
returngcd(b, a % b);
}
intmain() {
cout << gcd(15, 27);
}