Back
UCLN_Khu_De_Quy.cpp
Save
// UCLN_Khu_De_Quy.cpp #include
using namespace std; int ucln(int a, int b) { /*int r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b;*/ int r; while (b > 0) { r = a % b; a = b; b = r; } return a; } int main() { int a, b; cout << "Nhap a, b: "; cin >> a >> b; cout << "Ket qua: " << ucln(a, b); return 0; }