Tham khảo
program oken;
uses crt;
var a: array [1..100] of real;
i,n,dy,dtb,dk,dg:integer;
begin
clrscr;
write('Co bao nhieu ban can nhap diem: '); readln(N);
for i:=1 to n do
begin
write('nhap diem ban thu ',i,': ');
readln(a[i]);
if a[i]<5 then
dy:=dy+1
else if a[i]<6.4 then
dtb:=dtb+1
else if a[i]<7.9 then
dk:=dk+1
else
dg:=dg+1;
end;
writeln('So ban hoc yeu: ',dy);
writeln('So ban hoc trung binh: ',dtb);
writeln('So ban hoc kha: ',dk);
writeln('so ban hoc gioi: ',dg);
readln;
end.
program Phanloai;
uses crt;
Var i, n, Gioi, Kha, Trungbinh, Kem: integer;
A: array[1..100] of real;
Begin
clrscr;
write('Nhap so cac ban trong lop, n = '); readln(n);
writeln('Nhap diem:');
For i:=1 to n do Begin write(i,'.'); readln(a[i]); End;
Gioi:=0; Kha:=0; Trungbinh:=0; Kem:=0;
for i:=1 to n do
begin
if a[i]>=8.0 then Gioi:=Gioi+1;
if a[i]<5 then Kem:=Kem+1;
if (a[i]<8.0) and (a[i]>=6.5) then Kha:=Kha+1;
if (a[i]>=5) and (a[i]<6.5) then Trungbinh:=trungbinh+1
end;
writeln('Ket qua hoc tap:');
writeln(Gioi,' ban hoc gioi');
writeln(Kha,' ban hoc kha');
writeln(Trungbinh,' ban hoc trung binh');
writeln(Kem,' ban hoc kem');
readln
End.