写一个函数输出一个数的质因数int PrimeFactor(const int a)
int PrimeFactor(const int a) { int k = a; if (a <= 2) { return -1; } for (int i = 2; i <= k; ++i) { if ((k % i) == 0) { printf("%d\t", i); k = k / i; i--; } } return 0; }
写一个函数输出一个数的质因数int PrimeFactor(const int a)
int PrimeFactor(const int a) { int k = a; if (a <= 2) { return -1; } for (int i = 2; i <= k; ++i) { if ((k % i) == 0) { printf("%d\t", i); k = k / i; i--; } } return 0; }