#include<iostream.h>
int prime(int n)
{
int j=2;
while(n%j!=0)
j++;
if(j==n)
return 1;
else
return 0;
}
void main()
{
while(1)
{
int i,p,k,m;
cout<<"请输入一个2-10000的整型数:";
cin>>i;
m=i;
if(!prime(i))
{
cout<<"i=";
for(p=2;p<i;p++)
{
if(prime(p))
{
k=0;
while(i%p!=0)
{
m=m/p;
k++;
}
switch(k)
{
case 0: break;
case 1: cout<<p;
if(!prime(m))
cout<<"*";
break;
default :cout<<p<<"^"<<k;
if(!prime(m))
cout<<"*";
}
}
}
cout<<endl;
}
else
cout<<i<<endl;
}
}