2.
Program bai2;
uses crt;
var i,n,f1,f2: integer;
begin
clrscr;
write('Nhap n: '); readln(n);
f1:=0;
f2:=1;
for i:=1 to n do
begin
write(f1,' ');
f2:=f2+f1;
f1:=f2-f1;
end;
readln;
end.
Đúng 0
Bình luận (0)
1.
Program bai1;
uses crt;
var i,n: integer;
function kt(n: integer): boolean;
var i: integer;
begin
kt:=true;
for i:= 2 to n-1 do if (n mod i ) = 0 then
kt:=false;
end;
begin
clrscr;
write(' nhap n = '); readln(n);
for i:= 2 to n do
if kt(i) then write(i:3 , ' ');
readln;
end.
Đúng 0
Bình luận (1)