文章
34
粉丝
109
获赞
7
访问
19.3k
#include <stdio.h>
#include <math.h>
int isZhi(int x)
{
int flag = 1;
for (int i = 2; i <= sqrt(x); i++)
{
if (x % i == 0)
{
flag = 0;
break;
}
}
return flag;
}
int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
if (isZhi(n) != 1)
{
int index = 2;
while (n / index > 0)
{
if (n % index == 0 && isZhi(index) == 1)
{
printf("%d", index);
n = n / index;
index = 2;
if (n != 1)
{
printf("*");
}
}
else
{
index++;
}
}
printf("\n");
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发