K
Khách

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.

20 tháng 4 2023

Uses crt;

var n,i,max,min: integer;

a: array[1..100] of longint;

begin clrscr;

readln(n);

for i:=1 to n do read(a[i]); readln;

max:=a[1];

for i:=1 to n do if(max<a[i]) then max:=a[i];

writeln(max);

min:=a[1];

for i:=1 to n do if(min>a[i]) then min:=a[i];

writeln(min);

readln;

end.

4 tháng 5 2023

program TimMinMaxTrungBinh;

var

      N, i, max, min, sum: integer;

      a: array[1..50] of integer;

      TB, minTB, maxTB: real;

begin

      writeln('Nhap so nguyen duong N:');

      readln(N);

      sum := 0;

      for i := 1 to N do

      begin

            write('Nhap so thu ', i, ': ');

            readln(a[i]);

            sum := sum + a[i];

      end;

      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;

      TB := sum / N;

      minTB := TB;

      maxTB := TB;

      for i := 1 to N do

      begin

            if (a[i] < TB) and (a[i] < minTB) then

                  minTB := a[i];

            if (a[i] > TB) and (a[i] > maxTB) then

                  maxTB := a[i];

      end;

      writeln('Gia tri lon nhat la: ', max);

      writeln('Gia tri nho nhat la: ', min);

      writeln('Gia tri trung binh la: ', TB:2:2);

      if minTB = TB then

            writeln('Khong co gia tri nao nho hon TB')

      else

            writeln('Gia tri nho nhat < TB la: ', minTB);

      if maxTB = TB then

            writeln('Khong co gia tri nao lon hon TB')

      else

            writeln('Gia tri lon nhat > TB la: ', maxTB);

      readln;

end.

 
  

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,ln,t;

int main()

{

cin>>n;

ln=LLONG_MIN;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

ln=max(ln,x);

t+=x;

}

cout<<"So lon nhat la: "<<ln<<endl;

cout<<"Tong la: "<<t;

return 0;

}

12 tháng 5 2021

program tinh_trung_binh_cong;

uses crt;

var i,n,max,min:integer

tbc:real;

a:array[1..100]of 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;

tbc:=(max+min)/2;

writeln(tbc);

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((max+min)/2:4:2);

readln;

end.

12 tháng 5 2021

program tinh_trung_binh_cong;

uses crt;

var i,n,max,min:integer

tbc:real;

a:array[1..100]of 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;

tbc:=(max+min)/2;

writeln(tbc);

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((max+min)/2:4:2);

readln;

end.

uses crt;

var x,s,min:real;

i,n:integer;

begin

clrscr;

readln(n);

min:=-32000;

s:=1;

for i:=1 to n do 

begin

readln(x);

if min>x then min:=x;

s:=s*x;

end;

writeln('Nho nhat la: ',min:4:2);

writeln('Tich la: ',s:4:2);

readln;

end.

20 tháng 4 2022

Var a:array[1..20] of integer;

max,min:integer;

tbc:real;

Begin

For i:=1 to 20 do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

Max:=a[1];

Min:=a[1];

For i:=2 to 20 do

Begin

If a[i] > max then max:=a[i];

If a[i] < min then min:=a[i];

End;

tbc:=(max+min)/2;

Writeln('So lon nhat la ',max);

Writeln('So nho nhat la ',min);

Write('Trung binh cong la ',tbc:10:2);

Readln;

End.

Câu 1: 

uses crt;

var a:array[1..5]of integer;

max,i:integer;

begin

clrscr;

for i:=1 to 5 do 

  begin

write('A[',i,']='); readln(a[i]);

end;

max:=a[1];

for i:=1 to 5 do 

  if max<a[i] then max:=a[i];

writeln(max);

readln;

end.

Câu 2: 

uses crt;

var a:array[1..6]of integer;

min,i:integer;

begin

clrscr;

for i:=1 to 6 do 

  begin

write('A[',i,']='); readln(a[i]);

end;

min:=a[1];

for i:=1 to 6 do 

  if min>a[i] then min:=a[i];

writeln(min);

readln;

end.