Home > Back-end >  HELP
HELP

Time:03-23

CodePudding user response:

Many examples online, your download try, changed, must move to yourself

CodePudding user response:

Reference:
 # include 
#include

Int is_prime (int n);

Int main ()
{
Int I, CNT=0, sum=0;
For (I=1000; i<=9999; I++) {
{if (is_prime (I))
Cnt++;
The sum +=I;
Printf (" % % c - 6 d ", I, CNT % 10? "' : '\ n');
}
}
Printf (" \ ncount=% d, the sum=% d ", CNT, sum);

return 0;
}

Int is_prime (int n)
{
int i;
If (n & lt;
=1)return 0;
For (I=2; i <=SQRT (n); I++) {
If I (n %==0)
return 0;
}
return 1;
}

CodePudding user response:

refer to the second floor QZJHJXJ response:
for reference:
 # include 
#include

Int is_prime (int n);

Int main ()
{
Int I, CNT=0, sum=0;
For (I=1000; i<=9999; I++) {
{if (is_prime (I))
Cnt++;
The sum +=I;
Printf (" % % c - 6 d ", I, CNT % 10? "' : '\ n');
}
}
Printf (" \ ncount=% d, the sum=% d ", CNT, sum);

return 0;
}

Int is_prime (int n)
{
int i;
If (n & lt;
=1)return 0;
For (I=2; i <=SQRT (n); I++) {
If I (n %==0)
return 0;
}
return 1;
}
I don't agree to such a post reply, send the posts of most students, so easy to tell them the answer wouldn't hurt them,