用c分解一个6位数的质因数?

来源:百度知道 编辑:UC知道 时间:2024/05/11 19:44:00

void Func(int x)
{
if(x <0){
printf("Error, the parameter should not less than 0");

}
if(x == 1){
printf("\n");
return;
}

for(int i =2; i<= x; i++){
if(x%i == 0){
Func(x/i);
return;
}
}

}

我没有实际编译运行,可能会有些问题你就看看这个思路吧。