#include <iostream>
using namespace std;
int main(){
int a,b,hcf=0,i=1;
cout<<"Enter Value :";
cin>>a;
cout<<"Enter value :";
cin>>b;
while(i<=a || i<=b){
if(a%i ==0 && b%i ==0)hcf=i;
++i;
}
return 0;
}
还是余数法?
最佳答案
您找到 hcf 了吗?您似乎在尝试反转数字。
关于c++ - 这是找到hcf的好方法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4807173/