Code: Select all

```
#include<stdio.h>
#include<math.h>
int primes[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
int main()
{
int index = -1;
int N,numOfPrime,multipleOfPrime;
int i,k,j;
while(scanf("%d",&N)==1)
{
if(N==0)
break;
for(i=0;i<25;i++)
{
index = -1;
if(primes[i]>=N)
{
index = i;
break;
}
}
printf("%3d! =",N);
for(j=0;j<=index;j++)
{
numOfPrime = 0;
multipleOfPrime = 1;
for(k=0;multipleOfPrime<=N;k++)
{
multipleOfPrime*=primes[j];
numOfPrime+=(int)floor(N/multipleOfPrime);
}
if(numOfPrime)
{
if(j&&(j%15)==0)
{
printf("\n%9d",numOfPrime);
continue;
}
/*else*/
printf("%3d",numOfPrime);
}
}
printf("\n");
}
return 0;
}
```