num=num/k
who can stop me is me!
#include <stdio.h>
void main()
{
int num,k=2; //质因数从2开始.
printf(\"请输入一个数字:\");
scanf(\"%d\",&num);
while(num!=k)
{
while(num%k!=0)
{ num/=k;
k++;
if(num%k!=0)
printf(\"该数分解后为:%d*\",num);
printf(\"该数分解后为:%d\",num);
}
}printf(\"输入无效信息.\");
}
被你玩死啦,抄条式也抄不好,点运行哦?上面有很多符号都写错啦,我也想不明你点运行出2*3*3*5?能运行出2335已经不错了,
#include <stdio.h>
void main()
{
int num,k=2,flag=0;
printf("请输入一个数字:");
scanf("%d",&num);
printf("该数分解后为:%d=",num);
while(num!=1)
{
while(num%k==0)
{
num=num/k;
if(flag==1)
{
printf("*");
}
else
{
flag=1;
}
printf("%d",k);
}
k++;
}
getch();
}