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; }