View Code of Problem 91

#include <stdio.h>
#include <math.h>

int count(int x){
	if(x==1) return 0;
	for(int i=2; i<=sqrt(x); i++){
		if(x%i==0) return i;
	}
	return 0;
}

int main(){
	int n;
	//输入:1个整数n
	scanf("%d", &n);
	//处理
	printf("%d=", n);
	while(count(n)!=0){
		printf("%d*", count(n));
		n /= count(n);
	}
	//输出:1个字符串 
	printf("%d\n", n);
}

Double click to view unformatted code.


Back to problem 91