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 + 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 "<