program checkPrimeNumber;
varnum, i: integer;isPrime: boolean;
beginisPrime := true;
writeln('Enter a number:');readln(num);
if num <= 1 thenisPrime := falseelsebeginfor i := 2 to num div 2 dobeginif num mod i = 0 thenbeginisPrime := false;break;end;end;end;
if isPrime thenwriteln(num, ' is a prime number')elsewriteln(num, ' is not a prime number');
end.
program checkPrimeNumber;
var
num, i: integer;
isPrime: boolean;
begin
isPrime := true;
writeln('Enter a number:');
readln(num);
if num <= 1 then
isPrime := false
else
begin
for i := 2 to num div 2 do
begin
if num mod i = 0 then
begin
isPrime := false;
break;
end;
end;
end;
if isPrime then
writeln(num, ' is a prime number')
else
writeln(num, ' is not a prime number');
end.