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.
#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;
}
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.
uses crt;
var cao:array[1..60]of real;
i,n:integer;
max,min:real;
begin
clrscr;
write('Nhap so hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('Chieu cao cua ban thu ',i,'='); readln(cao[i]);
end;
max:=cao[1];
min:=cao[1];
for i:=1 to n do
begin
if max<cao[i] then max:=cao[i];
if min>cao[i] then min:=cao[i];
end;
writeln('Chieu cao thap nhat la: ',min:4:2);
writeln('Chieu cao cao nhat la: ',max:4:2);
readln;
end.
#include<iostream>
using namespace std;
int main() {
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
int g = a + b + c + d + e;
cout << g / 5;
return 0;
}
tham khảo
uses crt;
var cao:array[1..60]of real;
i,n:integer;
max,min:real;
begin
clrscr;
write('Nhap so hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('Chieu cao cua ban thu ',i,'='); readln(cao[i]);
end;
max:=cao[1];
min:=cao[1];
for i:=1 to n do
begin
if max<cao[i] then max:=cao[i];
if min>cao[i] then min:=cao[i];
end;
writeln('Chieu cao thap nhat la: ',min:4:2);
writeln('Chieu cao cao nhat la: ',max:4:2);
readln;
end.
Tham khảo
uses crt;
var cao:array[1..60]of real;
i,n:integer;
max,min:real;
begin
clrscr;
write('Nhap so hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('Chieu cao cua ban thu ',i,'='); readln(cao[i]);
end;
max:=cao[1];
min:=cao[1];
for i:=1 to n do
begin
if max<cao[i] then max:=cao[i];
if min>cao[i] then min:=cao[i];
end;
writeln('Chieu cao thap nhat la: ',min:4:2);
writeln('Chieu cao cao nhat la: ',max:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a[100];
int n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]>=1.5) cout<<fixed<<setprecision(2)<<a[i]<<" ";
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.
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.