Cau 2
Program xep hang
Var d:real;
uses crt;
BEGIN
if d < 5 then writeln('Yeu')
else if (d>=5) and (d<6.5) then writeln('Trung Binh')
else if (d>=6.5) and (d<8) then wrieln('Kha')
else writeln('Gioi');
END.
Cau 3:
Program tinhtong;
Var n,s,p,i:real;
Begin
Write('Nhap so n:'); Readln(n);
i:=1;
s:=1;
While i <= n do
Begin
i:=i+1;
p:= 1/i;
s:=s+p;
End;
Writeln('Tong cua cac phan so tren la',s);
End.
Cau 4
Var a,n,i, s,p: real;
BEGIN
Write('Nhap a, n:'); Read(a); Readln(n);
i:=0;
s:=1;
While i<=n do
Begin
p:= 1/(a+i);
s:= s +p;
i:=i+1
End;
Writeln('Tong la',s);
Readln;
END.