CodePudding user response:
Literally baidu a judgment whether the prime function of the ahCodePudding user response:
To get to 2000000000, print it out, time is a little long, for reference:# include & lt; Stdio. H>
Int main ()
{
Int x, m, n, CNT=0;
Bool flag;
The scanf (" % d ", & amp; N);
For (x=2; X<=n; X++)
{
Flag=true;
For (m=2; M * m<=x; M++)
{
If (x % m==0)
{
Flag=false;
break;
}
}
If (flag==true)
{
Cnt++;
Printf (" % 4 d % c, x, CNT % 5==0? '\ n' : ');
}
}
Printf (" % c % d \ n ", (CNT % 5!=0? B '\ n' : '\'), CNT);
return 0;
}