diff --git a/Arrays/Euclid's Algo b/Arrays/Euclid's Algo new file mode 100644 index 00000000..8b4853c2 --- /dev/null +++ b/Arrays/Euclid's Algo @@ -0,0 +1,16 @@ +The following algorithm is used to find the LCM and GCD of two integers: + +#include +using namespace std; +int gcd(int a, int b) { + if (b == 0) + return a; + return gcd(b, a % b); +} +int main() { + int a , b; + cout<<"Enter the values of a and b: "<>a>>b; + cout<<"GCD of "<< a <<" and "<< b <<" is "<< gcd(a, b); + return 0; +}