Eddy's research I
Problem Description
Eddy's interest is very extensive, recently he is interested in primenumber. Eddy discover the all number owned can be divided into the multiply ofprime number, but he can't write program, so Eddy has to ask intelligent you tohelp him, he asks you to write a program which can do the number to dividedinto the multiply of prime number factor .
Input
The input will contain anumber 1 < x<= 65535 per line representing the number of elements of theset.
Output
You have to print a linein the output for each entry with the answer to the previous question.
Sample Input
11
9412
Sample Output
11
2*2*13*181
程式碼如下:
#include<stdio.h>
int main()
{
int m;
while(scanf("%d",&m)!=EOF)
{
for(inti=2;i<=m;i++)
{
while(m%i==0)
{
if(m/i==1)
printf("%d\n",i);
else
printf("%d*",i);
m=m/i;
}
}
}
}