Solving prime numbers (c)
Enter all prime numbers between 100 and 200. (1) Implement # include <stdio. h> int main () {int I; int j; 1 <br> for (I = 100; I <= 200; I ++) {for (j = 2; j <= I-1; j ++) {if (I % j = 0) break;} if (j = I) printf ("% d", I );} return 0;} optimized: # include <stdio. h> int main () {int I; int j; for (I = 101; I <= 200; I = I + 2) {for (j = 2; j <= I/2; j ++) {if (I % j = 0) break;} if (j> = I/2) printf ("% d ", i);} return 0;} (2) number of times of comparing records # include <stdio. h> int main () {int I, j; int count = 0; for (I = 100; I <= 200; I ++) {count = 0; // each count needs to start from 0 for (j = 2; j <= I-1; j ++) {if (I % j = 0) break; elsecount ++;} if (count = I-2) // compare the number of records printf ("% d", I) ;}return 0 ;}( 3) boolean Type # include <stdio. h> int main () {int I, j; bool flag; for (I = 100; I <= 200; I ++) {flag = true; for (j = 2; j <= I-1; j ++) {if (I % j = 0) {flag = false; break ;}} if (flag) printf ("% d", I);} return 0 ;}