Viết chương trình tính điểm trung bình 3 môn (Toán, Lý, Hóa) theo hệ số (2:1:1) sau đó xếp loại như sau:
a) Loại Giỏi: ĐTB >= 8.0 và không có môn nào dưới 6.5
b) Loại Khá : 6.5=<ĐTB < 8.0 và không có môn nào dưới 5
c) Loại Trung bình : 5.0 =<ĐTB < 6.5 và không có môn dưới 3.5
d) Loại yếu: còn lại
GIÚP MÌNH
uses crt;
var t,l,h : integer;
tbc : real;
begin clrscr;
write(‘Nhap diem Toan :’); readln(t);
write(‘Nhap diem Ly :’); readln(l);
write(‘Nhap diem Hoa :’); readln(h);
tbc:=(t*2+l+h)/4;
if (tbc>=8) and (t>=6.5) and (l>=6.5) and (h>=6.5) then write(‘Gioi’) else
if (tbc<8) and (tbc>=6.5) and (t>=5.0) and (h>=5.0) and (l>=5.0) and (t>=5.0) and (h>=5.0) and (l>=5.0) then write(‘Kha’)
else if (tbc>=5) and (tbc<6.5) and (t>=3.5) and (h>=3.5) and (l>=3.5)
then write(‘Trung binh’) else write(‘Yeu’);
readln
end.
program Oken;
uses crt;
var dtb,toan,ly,hoa,min: real;
begin
clrscr;
write(‘Nhap mon Toan: ‘); readln(toan);
write(‘Nhap mon Ly: ‘); readln(ly);
write(‘Nhap mon Hoa: ‘); readln(hoa);
dtb:= (toan*2+ly+hoa)/4;
writeln(‘Diem trung binh: ‘,dtb:0:1);
min:= toan;
if min>ly then
min:=ly;
if min>hoa then
min:=hoa;
if (dtb>=8) and (min>=6.5) then
writeln(‘Gioi’)
else if (dtb>=6.5) and (min>=5) then
writeln(‘Kha’)
else if (dtb>=5) and (min>=3.5) then
writeln(‘Trung binh’)
else
writeln(‘Yeu’);
readln;
end.