View Code of Problem 91

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

int Prime(int m) {
	if (m == 1)
		return 0;
	int temp = sqrt(m);
	for (int i = 2;i <= temp;i++) {
		if (m%i == 0)
			return i;

	}
	return 0;
}

int main(){
	int n;
	scanf("%d",&n);
	int m = n;
	printf("%d=", n);
	while (Prime(m)) {
		int i = Prime(m);
		m = m / i;
		printf("%d*", i);
	}
	printf("%d\n", m);


}

Double click to view unformatted code.


Back to problem 91