scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0042-prime.c (231B)


      1 int
      2 main() {
      3 	int n;
      4 	int t;
      5 	int c;
      6 	int p;
      7 
      8 	c = 0;
      9 	n = 2;
     10 	while (n < 5000) {
     11 		t = 2;
     12 		p = 1;
     13 		while (t*t <= n) {
     14 			if (n % t == 0)
     15 				p = 0;
     16 			t++;
     17 		}
     18 		n++;
     19 		if (p)
     20 			c++;
     21 	}
     22 	if (c != 669)
     23 		return 1;
     24 	return 0;
     25 }
     26