# Include <stdio. h> # include <stdlib. h> # include <math. h> int isprime (int x) {If (x <= 0) {return 0;} else if (x = 1 | x = 2) {return 1 ;} else {int I; for (I = 2; I <X; I ++) {If (X % I = 0) {break ;}} if (I = x) {return 1;} else {return 0 ;}} void main () {int COUNT = 0; printf ("############ all prime numbers in less than 1000 ############## \ n "); for (INT I = 1; I <1000; I ++) {If (isprime (I) {printf ("% 6D", I); count ++; if (count % 8 = 0) {printf ("\ n") ;}} printf ("\ n ");}
############ All prime numbers within 1000 ##############
1 2 3 5 7 11 13 17
19 23 29 31 37 41 43 47
53 59 61 67 71 73 79 83
89 97 101 103 107 109 113
131 137 139 149 151 157 163
173 179 181 191 193 197 199
223 227 229 233 239 241 251
263 269 271 277 281 283 293
311 313 317 331 337 347 349
359 367 373 379 383 389 397
409 419 421 431 433 439 443
457 461 463 467 479 487 491
503 509 521 523 541 547 557
569 571 577 587 593 599 601
613 617 619 631 641 643 647
659 661 673 677 683 691 701
719 727 733 739 743 751 757
769 773 787 797 809 811 821
827 829 839 853 857 859 863
881 883 887 907 911 919 929
941 947 953 967 971 977 983
997
Press any key to continue...