C examples for Data Type:int
Generate a table of prime numbers.
#include <stdio.h> #include <stdbool.h> int main (void){ bool isPrime; for (int p = 3; p <= 50; p += 2) {//from w w w . j a v a 2 s. c o m isPrime = true; for (int d = 2; d < p; ++d && isPrime) if (p % d == 0) isPrime = false; if (isPrime != false) printf ("%i ", p); } return 0; }