Write a C++ Program For Find GCD
personRam Pothuraju
October 11, 2016
#include <iostream>
using namespace std;
int main() {
int n1, n2;
cout << "Enter two numbers: ";
cin >> n1 >> n2;
while(n1 != n2) {
if(n1 > n2)
n1 -= n2;
else
n2 -= n1;
}
cout << "GCD = " << n1;
return 0;
}
Output
Enter two numbers: 78
52
GCD = 26
Share to other apps