Skip to content

Instantly share code, notes, and snippets.

@DiegoNaterasPonce
Created March 13, 2016 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiegoNaterasPonce/9573605ac8edf69a269e to your computer and use it in GitHub Desktop.
Save DiegoNaterasPonce/9573605ac8edf69a269e to your computer and use it in GitHub Desktop.
#Quiz6
#include <iostream>
#include <iomanip>
using namespace std;
int euclid(int A,int B)
{
int C;
if(A==0)
return B;
else if(B==0)
return A;
else
{
C=A%B;
return euclid(B,C);
}
}
int main()
{
int A,B,GCD;
cout<<"We are going to find the Greatest Common Divisor of 2 numbers " <<endl;
cout<<"Give me the first number: ";
cin>>A;
cout<<"Give me the second number: ";
cin>>B;
GCD=euclid(A,B);
cout<<"The Greatest Common Divisor of these numbers is: "<<GCD<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment