Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions C++/Program-6/Readme.md
Original file line number Diff line number Diff line change
@@ -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

16 changes: 16 additions & 0 deletions C++/Program-6/program.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
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 "<<gcd(x,y);
return 0;
}