👤

se citeste de la tastatura un nr nat "n".Afisati numerele prime din intervalul 1-n
(cu instructiunea "for")


Răspuns :

var i,k,n,x:integer;

begin

read(n);

for k := 1 to n do begin
 
 x := 0;
 
 for i := 1 to k do
  if k mod i = 0 then inc(x);
 
 if x = 2 then write(k, ' ')
 
 end;

end.