viết chương trình nhập điểm của 10 học sinh.Tính (theo kiểu biến mảng)
- tổng điểm của 10 học sinh
- Điểm tb của 10 hs trên
- Đếm số học sinh có điểm >5
- Có bao nhiêu HSG
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var a:real;
begin
clrscr;
readln(a);
if (a>=9) then write('A')
else if ((7<=a) and (a<9)) then write('B')
else if ((5<=a) and (a<7)) then write('C')
else write('D');
readln;
end.
python
diem_tb = float(input("Nhập điểm trung bình của học sinh: "))
if diem_tb >= 9:
loai = 'A'
elif diem_tb >= 7:
loai = 'B'
elif diem_tb >= 5:
loai = 'C'
else:
loai = 'D'
print("Loại học sinh: ", loai)
Pascal
program PhanLoaiHocSinh;
var
diem_tb: real;
loai: char;
begin
write('Nhap diem trung binh cua hoc sinh: ');
readln(diem_tb);
if diem_tb >= 9 then
loai := 'A'
else if diem_tb >= 7 then
loai := 'B'
else if diem_tb >= 5 then
loai := 'C'
else
loai := 'D';
writeln('Loai hoc sinh: ', loai);
end.
Var a:array[1..35] of real;
i:integer;
Begin
For i:=1 to 35 do
Begin
Write('Nhap diem thu ',i);readln(a[i]);
End;
write('Diem vua nhap la ');
For i:=1 to 35 do write(a[i]:10:2);
Writeln;
write('Cac diem duoi 5 hoac > la ');
For i:=1 to 35 do
If (a[i]>9) or (a[i]<5) then write(a[i]:10:2)
Readln
End.
uses crt;
var st:array[1..10]of string;
a:array[1..10]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(st[i],a[i]);
for i:=1 to n do
writeln(st[i],' ',a[i]);
readln;
end.
Đây là code Pascal để nhập và in điểm kiểm tra học kì môn tin cho N của từng học sinh:
program DiemKT;
var
N, i: integer;
diem: array1..100 of integer;
begin
write('Nhap so hoc sinh: ');
readln(N);
for i := 1 to N do
begin
write('Nhap diem kiem tra hoc ki cua hoc sinh thu ', i, ': ');
readln(diemi);
end;
writeln('Diem kiem tra hoc ki cua ', N, ' hoc sinh la:');
for i := 1 to N do
writeln('Hoc sinh thu ', i, ': ', diemi);
end.
Gọi số học sinh lớp 8a đạt điểm 10 là x(bạn, x>0)
thì số học sinh lớp 8a là x/(5/7)= (7/5)x (bạn)
Nếu có thên 3 bạn đạt điểm 10 thì số bạn đạt điểm 10 là x+3 (bạn)
=> Số học sinh lớp 8a là (x+3)/80%= (x+3)/(4/5)= (5/4)(x+3)= (5/4)x+ 15/4 (bạn)
ta có phương trình (7/5)x= (5/4)x+ 15/4
<=> (3/20)x= 15/4
<=> x= (15/4)/(3/20)
<=> x= 25
x= 25 thoả mãn điều kiện của ẩn
=> Lớp 8a có 25 bạn được điểm 10
=> Số học sinh lớp 8a là: 25(7/5)= 35 bạn
**Vậy lớp 8a có 35 học sinh**
uses crt;
const n=10;
var diem:array[1..n]of real;
i,dem,dem1:integer;
t,tbc:real;
begin
clrscr;
for i:=1 to n do
begin
write('diem[',i,']='); readln(diem[i]);
end;
{-----------------------tinh-tong-diem-cua-10-hoc-sinh---------------------------------}
t:=0;
for i:=1 to n do
t:=t+diem[i];
writeln('tong diem cua 10 hoc sinh la: ',t:4:2);
{----------------------tinh-diem-tbinh-cua-10-hoc-sinh---------------------------------}
tbc:=t/n;
writeln('diem trung binh cua 10 hoc sinh la: ',tbc:4:2);
{---------------------dem-so-hoc-sinh-co-diem>5---------------------------------------}
dem:=0;
for i:=1 to n do
if diem[i]>5 then inc(dem);
writeln('so hoc sinh co diem lon hon 5 la: ',dem);
{---------------------dem-so-hoc-sinh-gioi--------------------------------------------}
dem1:=0;
for i:=1 to n do
if diem[i]>=8 then inc(dem1);
writeln('so hoc sinh gioi la: ',dem1);
readln;
end.