program PrimeNumber;
varnum, i: integer;isPrime: boolean;
beginisPrime := true;
write('Enter a natural number: ');readln(num);
if num <= 1 thenisPrime := falseelsebeginfor i := 2 to num - 1 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 PrimeNumber;
var
num, i: integer;
isPrime: boolean;
begin
isPrime := true;
write('Enter a natural number: ');
readln(num);
if num <= 1 then
isPrime := false
else
begin
for i := 2 to num - 1 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.