View Code of Problem 91

#include<stdio.h>
int sushu(int n){
	int i;
	for(i=2;i<n;i++)
       if(n%i==0)
	   {
		   return 0;
		   break;
	   }
	   return n;
}
int main(){
	int b[1000];
	int i,a,d,f;
    scanf("%d",&a);
	printf("%d=",a);
	f=a;
	for(d=0,i=2;i<f;i++)
		if(a%i==0 && sushu(i)>=2)
		{
			a=a/i;
			b[d++]=i;
			i--;
		}
		for(i=0;i<d;i++)
		{
			if (i<d-1)
				printf("%d*",b[i]);
			else
				printf("%d",b[i]);
		}
 
	return 0;	
}

Double click to view unformatted code.


Back to problem 91