#include <stdio.h>
#include <math.h>
int Factor[1000];
int cnt=0;

//Find the factor of num 
int isPrime(int num){
	int i;
	for(i=2;i<num;i++){
		if(num%i==0){
			if(Findfactor(i)){
				Factor[cnt]=i;
				cnt++;			//count how many factor does it has,which should be count
			}
		}
	} 
}

//Find the factor that is prime
int Findfactor(int num){
	int i;
	for(i=2;i<num;i++){
		return(num%i!=0);
	} 
}
 
 
int main(){
	int num;
	scanf("%d",&num);
	isPrime(num);

	int i;											//Look how many factor does it has,should equal to cnt 
	for(i=1;i<=cnt;i++){
		int cnt_Factor_num=0;
		while(num%Factor[i]==0){
			cnt_Factor_num++;
			printf("%d^%d",Factor[i],cnt_Factor_num);
			printf(" * ");
		}
		
	}
		
	/*int i=0;
	for(i=0;i<cnt;i++){
		printf("%d\n",Factor[i]);
	}*/
} 

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: