Viết chương trình nhập vào điểm trung bình của một học sinh và phân loại học sinh theo tiêu chuẩn sau:
9≤ Điểm TB Loại A7≤ Điểm TB < 9 Loại B5≤ Điểm TB < 7 Loại CĐiểm TB < 5 Loại DInputGồm số số thực TB(0<=TB<=10) �� (0≤��≤1OutputGhi ra một trong các kí tự thộc tập {A, B, C, D}.Sample InputCopy7.5Sample OutputCopy8Hã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.
![](https://rs.olm.vn/images/avt/0.png?1311)
Uses CRT;
Var TB : real;
BEGIN
clrscr;
repeat
begin
write('Moi ban nhap diem trung binh: ');
Readln(TB);
end;
until (TB>0) and (TB<10);
If (TB >= 8) then write('hoc luc gioi') else
If (TB>=6.5) then write('hoc luc kha') else
If (TB>5) then write('hoc luc trung binh') else
If (TB>3.5) then write('hoc luc yeu') else
write('hoc luc kem');
Readln;
END.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double a,b,c,tb;
int main()
{
cin>>a>>b>>c;
tb=(a+b+c)/3;
cout<<fixed<<setprecision(1)<<tb<<endl;
if (tb>=8) cout<<"Gioi";
else if ((6.5<=tb) and (tb<8)) cout<<"Kha";
else if ((5<=tb) and (tb<=6.5)) cout<<"Trung Binh";
else cout<<"Chua dat";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double a,b,c,tb;
int main()
{
cin>>a>>b>>c;
tb=(a+b+c)/3;
if (tb>=8) cout<<"Gioi";
else if ((6.5<=tb) and (tb<8)) cout<<"Kha";
else if ((5<=tb) and (tb<6.5)) cout<<"Trung Binh";
else cout<<"Chua Dat";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double x;
int main()
{
cin>>x;
if ((3.5<=x) and (x<=4.9)) cout<<"Yeu";
else if ((5.0<=x) and (x<=6.4)) cout<<"Trung binh";
else if ((6.5<=x) and (x<=7.9)) cout<<"Kha";
else cout<<"Gioi";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
Số học sinh giỏi là:
\(40:100\cdot20=8\)(học sinh)
Tổng số học sinh khá và trung bình là:
\(40-8=32\)(học sinh)
Ta có sơ đồ:
Khá |----|----|----|----|----|----|----|
TB |----|----|----|----|----|----|----|----|----|
Tổng số phần bằng nhau là:
\(7+9=16\)(phần)
Số học sinh khá là:
\(32:16.7=14\)(học sinh)
Số học sinh trung bình là:
\(32-14=18\)(học sinh)
Đáp số:Giỏi:8 học sinh
Khá:14 học sinh
TB:18 học sinh
~Study well~
![](https://rs.olm.vn/images/avt/0.png?1311)
Xin lỗi nha,ở đây có nhầm đề bài chút xíu
Phải là 1/16 số học sinh của lớp xếp loại TB
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double a[10],b,c,tb;
int n,i,dem;
int main()
{
cout<<"Nhap so cot thuong xuyen:"; cin>>n;
tb=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
tb=tb+a[i];
}
cin>>b>>c;
tb=tb+b+c;
cout<<fixed<<setprecision(2)<<tb/(n+2)<<endl;
if (tb>=8) cout<<"Gioi";
else if ((tb>=6.5) and (tb<8)) cout<<"Kha";
else if ((tb>=5) and (tb<6.5)) cout<<"Trung binh";
else cout<<"Yeu";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
double a[10],b,c,tb;
int i,n;
int main()
{
cout<<"Nhap so cot thuong xuyen:"; cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cout<<"Nhap diem giua ki:"; cin>>b;
cout<<"Nhap diem cuoi ki:"; cin>>c;
tb=0;
for (i=1; i<=n; i++) tb=tb+a[i];
tb=tb+b+c;
tb=tb/((n+2)*1.0);
cout<<fixed<<setprecision(2)<<tb<<endl;
if (tb>=8) cout<<"Gioi";
else if ((tb>=6.5) and (tb<8)) cout<<"Kha";
else if ((tb>=5) and (tb<6.5)) cout<<"Trung binh";
else cout<<"Yeu";
return 0;
}
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.