# 2032：【例4.18】分解质因数(2032: [example 4.18] decomposition quality factor)-其他

## 2032：【例4.18】分解质因数(2032: [example 4.18] decomposition quality factor)

### 【输入样例】

``36``

### 【输出样例】

``36=2*2*3*3``

### 【提示】

【数据范围】

``````#include<stdio.h>
#include<math.h>
int asd(int n)
{
int a=1;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
a=0;
break;
}
}
return a;
}
int main()
{
int n,y,i,j;
scanf("%d", &n);
y=n;
i=2;
printf("%d=",n);
while(1)
{
if(asd(i)&&(y%i==0))
{
y/=i;
if(y==1)
{
printf("%d\n", i);
break;
}
else printf("%d*",i);
}
else i++;
}
return 0;
}
``````
————————

### [Title Description]

Decomposing a composite number into the form of the product of several prime factors (that is, the process of finding the prime factor) is called decomposing the prime factor. Decomposition prime factor (also known as decomposition prime factor) is only for composite numbers.

Enter a positive integer NN and decompose NN into the form of prime factor product.

### [input]

A positive integer NN.

### [output]

It is decomposed into the form of prime factor product. The quality factor must be from small to large, as shown in the example.

### [input example]

``36``

### [output example]

``36=2*2*3*3``

### [tips]

[data range]

For all data, 2 ≤ n ≤ 200002 ≤ n ≤ 20000.

``````#include<stdio.h>
#include<math.h>
int asd(int n)
{
int a=1;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
a=0;
break;
}
}
return a;
}
int main()
{
int n,y,i,j;
scanf("%d", &n);
y=n;
i=2;
printf("%d=",n);
while(1)
{
if(asd(i)&&(y%i==0))
{
y/=i;
if(y==1)
{
printf("%d\n", i);
break;
}
else printf("%d*",i);
}
else i++;
}
return 0;
}
``````