Tin học Viết chương trình

A

anhkemdau4520

H

harry9xsakura

program diem;
uses crt;
var van,toan,tong,min,max:real;
i,g,k,tb,n,y:longint;
begin clrscr;
writeln('nhap so hoc sinh');
readln(n);
for i:=1 to n do
begin
writeln('hoc sinh thu ',i);
writeln('diem van');
readln(van);
writeln('diem toan');
readln(toan);
tong:=(toan+van)/2;
writeln('diem trung binh la ',tong);
readln;
if tong<min then min:=tong;
if tong>max then max:=tong;
if tong>=8 then inc(g) else
if tong>=6.5 then inc(k) else
if tong>=5 then inc(tb) else inc(y);
end;
writeln('so hoc sinh gioi la ',g);
writeln('so hoc sinh kha la',k);
writeln('so hoc sinh trung binh la',tb);
writeln('so hoc sinh yeu la',y);
writeln('diem thap nhat la',min);
writeln('diem cao nhat la',max);
readln;
end.
 
H

huutoan00

Mã:
var toan,van,tong:array [1..100] of real;
      i,n,g,k,y,tb:integer;
      max,min:real;
begin
   write('Nhap so hoc sinh :');readln(n);
   for i:=1 to n do
      begin
         write('Nhap diem toan cua hs ',i,' :');readln(toan[i]);
         write('Nhap diem van cua hs ',i,' :');readln(van[i]);
         tong[i]:=(van[i]+toan[i])/2;
         if tong[i]<min then min:=tong[i];
         if tong[i]>max then max:=tong[i];
         if tong[i]>=8 then inc(g) else
         if tong[i]>=6.5 then inc(k) else 
         if tong[i]>=5 then inc(tb) else inc(y);
      end;
   writeln('So hoc sinh gioi la ',g);
   writeln('So hoc sinh kha la ',k); 
   writeln('So hoc sinh trung binh la ',tb);
   writeln('So hoc sinh yeu la ',y);
   writeln('Diem thap nhat la ',min);
   writeln('Diem cao nhat la ',max);
   readln;
end.
 
Top Bottom