Skip to content

Commit 5ee28e5

Browse files
committed
stdbool
1 parent ec701a2 commit 5ee28e5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

prog.6.10A.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Program to generate a table of prime numbers
2+
3+
#include <stdio.h>
4+
#include <stdbool.h>
5+
6+
int main (void)
7+
{
8+
int p, d;
9+
bool isPrime;
10+
11+
for ( p = 2; p <= 50; ++p ) {
12+
isPrime = true;
13+
14+
for ( d = 2; d < p; ++d )
15+
if ( p % d == 0 )
16+
isPrime = false;
17+
18+
if ( isPrime != false )
19+
printf ("%i ", p);
20+
}
21+
22+
printf ("\n");
23+
return 0;
24+
}

0 commit comments

Comments
 (0)