#include<stdio.h>
main()
{
char ch;
unsigned long num;
unsigned long i;
while (1)
{
printf("Please input a number:\n");
scanf("%lu",&num);
printf("%lu=",num);
for(i=2;i<=num;i++)
{
if(num%i==0)
{
if(num==i)
printf("%lu",i);
else
{
printf("%lu*",i);
num=num/i;
i=1;
}
}
}
printf("\nWould you like to run the program again?y/n\n");
ch=getch();
if(ch!='y')
exit(0);
}
}
呵呵,楼上的倒挺细心的,原本的程序是这样的,上次我把后面可重复执行的步骤给删掉了,倒漏了删这个变量了
对不礼貌的女生收钱......