Program n1; var n: integer; function pr(a: integer ):boolean; var i: integer; begin if a<2 then pr:=false else begin pr:=true; for i:=2 to round(sqrt(a)) do if a mod i=0 then pr:=false; end; end; begin readln(n); if pr(n) then write('yes') else write('no'); end.
Answers & Comments
Verified answer
Program n1;var n: integer;
function pr(a: integer ):boolean;
var i: integer;
begin
if a<2 then pr:=false
else begin
pr:=true;
for i:=2 to round(sqrt(a)) do
if a mod i=0 then pr:=false;
end;
end;
begin
readln(n);
if pr(n) then write('yes')
else write('no');
end.