Prime Numbers in Pascal programming

The following program code will display primes with pascal programming language within a certain value (in this case is limited to 100). Also accompanied by an explanation of each step - step.









uses crt;varx, y: integer;prime: boolean;beginclrscr;write ('2 ');for x: = 3 to 100 dobeginprime: = true;for y: = 2 to x-1 dobeginif (x mod y) = 0 thenbeginprime: = false;break;end;end;if prime

0 Response to "Prime Numbers in Pascal programming"

Posting Komentar