Home > Back-end >  For help, qualitative factor number
For help, qualitative factor number

Time:11-27

#include
#include
#include
#include
using namespace std;
Bool prime (int n) {
Bool yes=true;
for(int i=2; i<=SQRT (n); I++) {
If I==0) (n % {
Yes=false;
break;
}
}
Return yes;
}
Int main ()
{
Int num, ans=0;
scanf("%d",& Num);
Int Max=floor (SQRT (num));
for(int i=2; i<=Max; I++)
{
If (prime (I)==true)
{
If (num % I==0)
{
Ans++;
While (num % I==0)
{
Num/=I;
}
}
}
}
coutreturn 0;
}
Ask everybody to help me see what is wrong, always one less,

CodePudding user response:

https://paste.ubuntu.com/p/72gq4s2pmk/

Have you look at this, I made modification, should be ok, your problem is mainly to prime function and for the process of an integer factor
  • Related