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.
Var a:array:[1..1000] of real;
i,n:integer;
max,min,s,tb:real;
Begin
Write('Nhap so luong hoc sinh: ');readln(n);
For i:=1 to n do
Begin
Write('Nhap chieu cao hs thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
tb:=s/n;
max:=a[1];min:=a[1];
For i:=2 to n do
Begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
end;
writeln('Chieu cao lon nhat la ',max:10:1);
Writeln('Chieu cao nho nhat la ',min:10:1);
Write('Chieu cao trung binh la ',tb:10:1);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
double a[1000],t;
int n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<fixed<<setprecision(2)<<t/(n*1.0);
return 0;
}
a)
var a:array[1..100] of longint;
n,i,max,d:longint;
begin
read(n);
for i:=1 to n do
write('nhap chieu cao, don vi cm');read(a[i]);
b) max:=a[1];
for i:=2 to n do
if a[i]>max then max:=a[i];
writeln('ban cao nhat cao',max);
c) for i:=1 to n do
if a[i]>160 then d:=d+1;
write('so ban cao hon 160 cm la: ',d);
end.
program trungbinh;
uses crt;
var n,i: integer;
s:real;
A: array[1..1000] of integer;
begin
clrscr;
write('Nhap do dai day: '); readln(n);
writeln('Nhap gia tri cua day: ');
S:=0;
for i:=1 to n do
begin
write('A[',i,']= ');
readln(A[i]);
S:=S+A[i];
end;
S:=S/n;
write('Trung binh cua cac so cua day do la: ',S);
readln;
end.
uses crt;
var a:array[1..60[of real;
i,n:integer;
begin
clrscr;
write('Nhap so ban:'); readln(n);
for i:=1 to n do
begin
write('Chieu cao cua ban thu ',i,' la: '); readln(a[i]);
end;
for i:=1 to n do
writeln('Ban thu ',i,' cao ',a[i],'m');
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,max,min,n: integer;
begin
write('Nhap so phan tu 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 a[i]>max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('So nho nhat la :',max);
write('So lon nhat la: ',min);
readln
end.
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..20]of real;
t,tb,ln,nn:real;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do t:=t+a[i];
writeln(t:4:2);
writeln(t/n:4:2);
nn:=a[1];
ln:=a[1];
for i:=1 to n do
begin
if nn>a[i] then nn:=a[i];
if ln<a[i] then ln:=a[i];
end;
writeln(nn);
writeln(ln);
readln;
end.
uses crt;
var n, i, j, dem: longint; {Bạn có thể thay longint thành integer nha}
A:array[1..1000] of longint;
begin
clrscr;
Write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': ');
readln(A[i]);
end;
Write('Cac so nguyen to co trong mang la: ');
for i:=1 to n do
begin
dem:=0;
for j:=2 to A[i]/2 do
if A[i] mod j=0 then dem:=dem+1;
if dem=0 then write(A[i],'; ');
end;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
readln;
end.