program PrimeNumber;
varN, i: Integer;isPrime: Boolean;
beginisPrime := true;
write('Enter a natural number N: ');readln(N);
if N <= 1 thenisPrime := falseelsebeginfor i := 2 to N div 2 dobeginif N mod i = 0 thenbeginisPrime := false;break;end;end;end;
if isPrime thenwriteln(N, ' is a prime number')elsewriteln(N, ' is not a prime number');
end.
program PrimeNumber;
var
N, i: Integer;
isPrime: Boolean;
begin
isPrime := true;
write('Enter a natural number N: ');
readln(N);
if N <= 1 then
isPrime := false
else
begin
for i := 2 to N div 2 do
begin
if N mod i = 0 then
begin
isPrime := false;
break;
end;
end;
end;
if isPrime then
writeln(N, ' is a prime number')
else
writeln(N, ' is not a prime number');
end.