program PredelnieChisla;
var
A, B, i, j: integer;
isPrime: boolean;
begin
write('Введите нижний предел (A): ');
readln(A);
write('Введите верхний предел (B): ');
readln(B);
for i := A to B do
isPrime := true;
for j := 2 to i div 2 do
if (i mod j = 0) then
isPrime := false;
break;
end;
if isPrime then
write(i, ' ');
writeln;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program PredelnieChisla;
var
A, B, i, j: integer;
isPrime: boolean;
begin
write('Введите нижний предел (A): ');
readln(A);
write('Введите верхний предел (B): ');
readln(B);
for i := A to B do
begin
isPrime := true;
for j := 2 to i div 2 do
begin
if (i mod j = 0) then
begin
isPrime := false;
break;
end;
end;
if isPrime then
write(i, ' ');
end;
writeln;
end.