View Code of Problem 91

#include<stdio.h>
int main(){
	int n;
	while(scanf("%d", &n)!=EOF && n!=0){  
		printf("%d=", n);
		
		for(int i=2; i*i<=n; i++){ //素数筛法 
			while(n != i){
				if(n % i == 0){
					printf("%d*", i); //先输出
					n /= i;
				}
				else break;
			}
		}//for
		
		printf("%d\n", n);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 91