求助一道算法题目
题目是 :从终端任意输入一个正整数,对该数分解质因数并打印出来。例如输入90,打印出 90=2*3*3*5
程序代码:#include<stdio.h>
void defact(int y)
{
int is_first=1,factor=1;
do{
if(y%factor==0&&factor!=1){
if(is_first){
printf("%d=%d",y,factor);
is_first=0;
}
else
printf("*%d",factor);
y/=factor;
}
else
++factor;
}while(y>1);
}
int main()
{
int n;
scanf("%d",&n);
defact(n);
return 0;
}
