From 0e5a252b608b8b9da152d923aedc4ed70fbcb1c9 Mon Sep 17 00:00:00 2001 From: Khushi Sharma <92581650+khushi2762@users.noreply.github.com> Date: Sun, 9 Oct 2022 17:23:07 +0530 Subject: [PATCH] Create Euclid's Algo good first issue hacktoberfest 2022 pls merger my PR! :) --- Arrays/Euclid's Algo | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Arrays/Euclid's Algo 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; +}