View Code of Problem 91

#include<iostream>
#include<math.h>
#include<cstring>
using namespace std;
int zhishu(int n){
	for(int i=2;i<n;i++){
		if(n%i==0)
		return 0;
	}
	return 1;
}
int main()
{
	int n;
	cin>>n;
	cout<<n<<"=";
	int x=n;
	for(int i=2;i<x;){
		if(zhishu(i)&&n%i==0){
			cout<<i;
			n=n/i;
			if(n!=1)
			cout<<"*";
				
		}else{
			i++;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 91