From e8afe45d531a20fcfb60dcd69e253859fd9af64b Mon Sep 17 00:00:00 2001 From: Tanushree Aggarwal <47485195+shreetanu@users.noreply.github.com> Date: Wed, 7 Oct 2020 16:05:38 +0530 Subject: [PATCH 1/2] Program.cpp A program in C++ that finds the Greatest common divisor or Highest common factor of two numbers. --- C++/Program-6/program.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 C++/Program-6/program.cpp diff --git a/C++/Program-6/program.cpp b/C++/Program-6/program.cpp new file mode 100644 index 00000000..23a755c2 --- /dev/null +++ b/C++/Program-6/program.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +int gcd(int x,int y) +{ + if(y==0) + return x; + return gcd(y,x%y); +} + +int main() { + cout<<"enter the numbers\n"; + int x,y; + cin>>x>>y; + cout<<"The GCD is "< Date: Wed, 7 Oct 2020 16:10:20 +0530 Subject: [PATCH 2/2] Readme.md --- C++/Program-6/Readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 C++/Program-6/Readme.md diff --git a/C++/Program-6/Readme.md b/C++/Program-6/Readme.md new file mode 100644 index 00000000..00f303b9 --- /dev/null +++ b/C++/Program-6/Readme.md @@ -0,0 +1,10 @@ +Program 6 + +Write a program to find the greatest common divisor of two number. + +Variable description-- + +x=Holds the first number + +y=Holds the second number +