viết chương trình nhập điểm và tính điểm trung bình cho học sinh một lớp có n học sinh
điểm trung bình được tính như sau :
điểm tb(dtb)=(diemvan(dv) + diemtoan(dt))/2
Viết chương trình nhập vào điểm học kì môn Tin học sau đó tính điểm trung bình của cả lớp, thông báo điểm của học sinh cả lớp và điểm trung bình của lớp?
#include <bits/stdc++.h>
using namespace std;
double a[100],t;
int n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
cout<<"Diem cua ban thu "<<i<<" la: "<<fixed<<setprecision(2)<<a[i]<<endl;
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<"Trung binh cua lop la: "<<fixed<<setprecision(2)<<t/(n*1.0);
return 0;
}
viết chương trình nhập điểm kiểm tra học kì I môn tin học cho n học sinh (với n và điểm được nhập từ bàn phím ) và in ra các kết quả sau: A: tổng điểm của lớp B:Điểm trung bình của lớp C:điểm cao nhất D:số học sinh đạt trung bình trở lên Lưu ý: Sử dụng biến đếm : For := to đó; Sử dụng biến mảng: var :array[..] of integer;
viết chương trình sử dụng biến mảng, thực hiện các công việc sau:
- Nhập từ bàn phím danh sách HỌ TÊN, điểm trung bình môn TOÁN,VĂN,TIN của các bạn học sinh trong lớp
- Tính điểm trung bình của từng học sinh.
- Tìm học sinh có điểm trung bình cao nhất.
viết chương trình sử dụng biến mảng, thực hiện các công việc sau:
- Nhập từ bàn phím danh sách HỌ TÊN, điểm trung bình môn TOÁN,VĂN,TIN của các bạn học sinh trong lớp
- Tính điểm trung bình của từng học sinh.
- Tìm học sinh có điểm trung bình cao nhất.
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 OutputCopy8uses 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 TB:real;
begin
readln(TB);
if TB>=9 then
writeln('A')
else if TB>=7 then
writeln('B')
else if TB>=5 then
writeln('C')
else
writeln('D');
readln;
end.
viết chương trình tính điểm cho học sinh và cho biết học lực của học sinh( nhập điểm toán, lý, hóa, văn, anh, điểm trung bình)
uses crt;
var toan,ly,hoa,van,anh,dtb:real;
begin
clrscr;
write('Nhap diem Toan:'); readln(toan);
write('Nhap diem Ly:'); readln(ly);
write('Nhap diem Hoa:'); readln(hoa);
write('Nhap diem Van:'); readln(van);
write('Nhap diem Anh:'); readln(anh);
dtb:=(toan+ly+hoa+van+anh)/5;
if dtb>=8 then writeln('Gioi');
if (6,5<=dtb) and (dtb<8) then writeln('Kha');
if (5<=dtb) and (dtb<6,5) then writeln('Trung binh');
if dtb<5 then writeln('Yeu');
readln;
end.
Câu 1:
a)Viết chương trình khai báo và biến mảng V có 20 phần tử
b) Nhập điểm cho n học sinh với n <= 20 được nhập từ bàn phím
c)Tìm học sinh có điểm cao nhất và học sinh có điểm thấp nhất, tính điểm trung bình của các học sinh đó?
d) Dừng xem kết quả và in ra kết quả màn hình?
Giúp mình với.
Viết chương trình nhập điểm 10 bạn học sinh viết chương trình in ra các bạn học sinh giỏi, Tính điểm trung bình của10 bạn
uses crt;
var a:array[1..10]of integer;
i,n,tb:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 10 do
if a[i]>=8 then write(a[i]:4);
tb:=0;
for i:=1 to 10 do
tb:=tb+a[i];
writeln;
writeln('Diem trung binh cua 10 ban la: ',tb:4:2);
readln;
end.
Bài 1: Hãy lập chương trình nhập vào điểm trung bình của một lớp học có N học sinh, rồi in ra:
a. Điểm trung bình của học sinh cả lớp
b. Tỉ lệ học sinh gỏi, khá, trung bình và yếu
Giúp mik với, mik cần gấp ạ !!! ( Đây là bài mảng một chiều )
a:
#include <bits/stdc++.h>
using namespace std;
double tbc,x;
long long n,i;
int main()
{
cin>>n;
tbc=0;
for (i=1; i<=n; i++)
{
cin>>x;
tbc=tbc+x;
}
cout<<fixed<<setprecision(2)<<tbc/(n*1.0);
return 0;
}