Trần Mai Anh
(Tran Mai Anh)
New Member
**So nguyen to:
var n,i,j:integer;ok:boolean;
begin
write('cho n=');readln(n);
writeln('Cac so nguyen to trong pham vi n la:');
for i:=2 to n do
begin j:=2;ok:=true;
while (j<=i div 2) and (ok:=true) do
begin
if i mod j=o then ok:=false;
inc(j);
end;
if ok=true then write(i,' ');
end;
readln;
end.
FIBO dễ lắm, làm như ở hk1 thôi.
var n,i,j:integer;ok:boolean;
begin
write('cho n=');readln(n);
writeln('Cac so nguyen to trong pham vi n la:');
for i:=2 to n do
begin j:=2;ok:=true;
while (j<=i div 2) and (ok:=true) do
begin
if i mod j=o then ok:=false;
inc(j);
end;
if ok=true then write(i,' ');
end;
readln;
end.
FIBO dễ lắm, làm như ở hk1 thôi.
Chỉnh sửa lần cuối: