Mình có sai ở chô nào ko ạ? mong các bạn sửa giúp
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.0 then Kem:=Kem+1;
if a[i] <8.0 ) and a[i] >=6.5) then Kha:= Kha + 1;
if a[i] >= 5.0 ) 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
chỗ sai:
if a[i] <8.0 ) and a[i] >=6.5) then Kha:= Kha + 1; (thiếu dấu mở ngoặc)
if a[i] >= 5.0 ) and a[i] < 6.5) then Trungbinh:= Trungbinh + 1; (như trên)
End (thiếu dấu chấm ở cuối)
sửa:
if (a[i] <8.0 ) and (a[i] >=6.5) then Kha:= Kha + 1;
if (a[i] >= 5.0 ) and (a[i] < 6.5) then Trungbinh:= Trungbinh + 1;
End.
${Oken}$