Created
March 13, 2016 04:07
-
-
Save DiegoNaterasPonce/9573605ac8edf69a269e to your computer and use it in GitHub Desktop.
#Quiz6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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