#include <stdio.h>
int main()
{
int i,a;
while (scanf("%d",&a)!=EOF){
for (i=2;i<=a;i++)
{
int b=0;
while (a % i == 0)
{
b++;
a= a/i;
}
if (a == 1 && b > 1){
printf("%d^%d",i,b);
}
if (a > 1 && b == 1){
printf("%d * ",i);
}
if (a == 1 && b == 1) { printf("%d\n",i); }
if (a > 1 && b > 1){
printf("%d^%d * ",i,b);
}
}
}
}
#include
int main()
{
int i,a;
while (scanf("%d",&a)!=EOF){
for (i=2;i<=a;i++)
{
int b=0;
while (a % i == 0)
{
b++;
a= a/i;
}
if (a == 1 && b > 1){
printf("%d^%d",i,b);
}
if (a > 1 && b == 1){
printf("%d * ",i);
}
if (a == 1 && b == 1) { printf("%d\n",i); }
if (a > 1 && b > 1){
printf("%d^%d * ",i,b);
}
}
}
}
以解答