CodePudding user response:
Reference:# include
# include
Int isPrime (int n);
Int main ()
{
Int n, m, sum=0;
The scanf (" % d ", & amp; N);
While (n -) {
The scanf (" % d ", & amp; M);
If (isPrime (m)) sum +=m;
}
Printf (" % d ", sum);
return 0;
}
Int isPrime (int n)
{
If (n & lt; {
=3)Return n & gt; 1;
}
Int SQR=(int) SQRT (n);
For (int I=2; I & lt;=SQR; I++) {
If I==0) (n % {
return 0;
}
}
return 1;
}
//run results:
//5
//2, 3, 4, 5 6
//10 please press any key to continue...
CodePudding user response:
Thank you very very much