viết chương trình nhập chiều cao 3 bạn trong lớp tìm và hiển thị ra màn hình bạn có chiều cao thấp nhất ( pascal)
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;
}
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;
}
program Chieu_cao;
uses crt;
var Long, Trang : integer;
begin
writeln('Nhap chieu cao cua Long (Duoi dang cm)');
readln(Long);
writeln('Nhap chieu cao cua Trang (Duoi dang cm)');
readln(Trang);
if Long > Trang then writeln('Long cao hon Trang')
else writeln('Trang cao hon Long);
end.
#AeMZn
program Chieu_cao;
uses crt;
var Long, Trang : integer;
begin
writeln('Nhap chieu cao cua Long (Duoi dang cm)');
readln(Long);
writeln('Nhap chieu cao cua Trang (Duoi dang cm)');
readln(Trang);
uses crt;
var i:integer;
a:array[1..20]of string;
begin
clrscr;
for i:=1 to 20 do readln(a[i]);
for i:=1 to 20 do
writeln('Xin chao, ban thu ',i,' ten la: ',a[i]);
readln;
end.
Program Hoc24;
var i: byte;
begin
for i:=1 to 20 do
writeln('Chao ban thu ',i);
readln
end.
1:
uses crt;
var a:array[1..100]of integer;
i,n,max: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];
writeln(max);
readln;
end.
program oken;
uses crt;
var a: array [1..100] of integer;
i,n,max:integer;
begin
clrscr;
write('nhap so n: '); readln(n);
for i:=1 to n do
begin
write('a[',i,']: ');
readln(a[i]);
end;
b,
program aicaohon;
uses crt;
var Nhi, Tram,An:real;
begin
clrscr;
write('nhap chieu cao cua Nhi=');readln(Nhi);
write('nhap chieu cao cua Tram='); readln(Tram);
if Nhi>Tram then writeln('Ban Nhi cao hon');
if Tram>Nhi then writeln('Ban Tram cao hon')
if An>Tram>Nhi then writeln( 'Ban An cao nhat')
else writeln('An cao nhat');
readln
end.
max:=a[1];
for i:=2 to n do
if a[i]>max then
max:=a[i];
writeln('Max: ',max);
readln;
end.
uses crt;
var a,b,c:real;
begin
clrscr;
write('nhap chieu cao cua ban thu 1:'); readln(a);
write('nhap chieu cao cua ban thu 2:'); readln(b);
write('nhap chieu cao cua ban thu 3:'); readln(c);
nn:=a;
if nn>b then nn:=b;
if nn>c then nn:=c;
writeln('ban co chieu cao thap nhat la: ',nn);
readln;
end.
program chieu_cao;
uses crt;
var a,b,c:integer;
begin
clrscr;
write('nhap bn thu nhat');readln(a);
write('nhap bn thu hai:');readln(b);
write('nhap bn thu ba:');readln(c);
if (a<b) and (a<c) then writeln('bn thu nhat thap nhat')
if (b<c) and (b<a) then writeln('bn thu hai thap nhat')
else writeln('bn thu ba thap nhat');
readln
end.
OK