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.
a)
program Diem_trung_binh;
uses crt;
var i, n: integer;
giatriTB: real;
A: array[1..100] of real;
begin
clrscr;
write('Nhap so hoc sinh lop 8A: ');
readln(n);
writeln('Nhap diem cua moi ban:');
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
giatriTB:=giatriTB+a[i]
end;
giatriTB:=giatriTB/n;
writeln('Diem trung binh cua 50 hoc sinh lop 8A la: ', giatriTB:3:2);
readln
end.
uses crt;
var i,n,d:longint;
a:array[1..100] of real;
d1:real;
begin
clrscr;
write('Nhap so hoc sinh trong mot lop: '); readln(n);
for i:=1 to n do
begin
write('Diem trung binh cua hoc sinh thu ',i,' la: ');readln(a[i]);
end;
for i:=1 to n do
if a[i]>=5 then inc(d);
writeln('So luong hoc sinh dat diem trung binh tro len la: ',d);
d1:=d/n*100;
write('Ti le hoc sinh dat diem trung binh tro len la: ',d1:0:0,'%');
readln
end.
uses crt;
var i,d,n:byte;
a:array[1..10]of real;
begin
write('nhap si so lop :');readln(n);
d:=0;
for i:=1 to n do begin
write('nhap diem tb ban thu ',i,' );readln(a[i]);
if a[i]>5.0 then d:=d+1;
end;
writeln('so luong hs dat diem tb tro len la:',d);
writeln('ti le hs dat diem tb tro len la :', (d/n)*100);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a-b;
return 0;
}
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,max,min,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
writeln('Trung binh cua day so la: ',t/n:4:2);
readln;
end.
THAM KHẢO:
uses crt;
var a,cv,dt:integer;
begin
clrscr;
write('a='); readln(a);
cv:=a*4;
dt:=sqr(a);
if a>0 then
begin
writeln('chu vi hinh vuong la: ',cv);
writeln('dien tich hinh vuong la: ',dt);
end
else writeln('vui long nhap so a lon hon 0');
readln;
end.
uses crt;
var cao:array[1..100]of real;
n,i,dem:integer;
tb:real;
begin
clrscr;
write('Nhap so ban hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('Chieu cao cua ban thu ',i,'='); readln(cao[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+cao[i];
writeln('Chieu cao trung binh cua lop la: ',tb/n:4:2);
dem:=0;
for i:=1 to n do
if cao[i]<tb then dem:=dem+1;
writeln('So luong hoc sinh trong lop co chieu cao thap hon chieu cao trung binh cua lop la: ',dem);
readln;
end.