ProjectEuler/c++/lib/factor.cpp
2013-04-17 14:34:39 +08:00

34 lines
441 B
C++

#include <iostream>
using namespace std;
typedef unsigned long long int uu;
void function(uu n)
{
uu m, k, t;
t = 1;
m = n;
while (m > 1) {
k = 2;
while (m % k != 0) k++;
if (t) cout << k;
else cout << "*" << k;
m = m / k;
t = 0;
}
cout << endl;
}
int main()
{
cout << "use 0 to exit" << endl;
uu num;
do {
cin >> num;
if(num == 0) break;
function(num);
} while(1);
return 0;
}