Những câu hỏi liên quan
 ohsusu
Xem chi tiết
Minh Lệ
30 tháng 4 2021 lúc 16:32

Program HOC24;

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

i,max,,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];

for i:=1 to n do

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

write('So lon nhat la: ',max);

readln

end.

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:00

uses crt;
var a:array[1..1000000] of longint;
      n,i,max:longint;
begin
      clrscr;
      write('Nhap so luong phan tu: '); readln(n);
      max:=a[1];
      for i:=1 to n do 
            begin
                  write('Nhap phan tu thu ',i,': '); readln(a[i]);
                  if a[i]>max then max:=a[i];
            end;
      writeln('GTLN: ',max);
      readln;
end.

Bình luận (0)
Uchiha Obito
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 5 2021 lúc 20:37

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.

Bình luận (0)
HUY HUỲNH QUANG
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 14:54

Bài 5:

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

i,n,max:integer;

sc, sl:longint;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

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

If a[i] mod 2 = 0 then sc:=sc+b[i];

If a[i] mod 2 <> 0 then sl:=sl+a[i];

End;

max:=a[1];

For i:=2 to n do

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

Writeln('Tong cac so chan la ',sc);

Writeln('Tong cac so le la ',sl);

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

Readln

End.

Bình luận (1)
Phan Thị Phương Thy
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 4 2021 lúc 19:03

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.

Bình luận (0)
Minh Lệ
28 tháng 4 2021 lúc 20:26

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.

Bình luận (0)
Tuoi tom May
Xem chi tiết
Phía sau một cô gái
4 tháng 5 2023 lúc 20:40

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.

 
  
Bình luận (0)
Ái Cầm Trần
Xem chi tiết
Hiếu Phùng Mạnh
Xem chi tiết
Minh Lệ
2 tháng 5 2023 lúc 20:30

Program HOC24;

var min,max,i,n: integer;

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

begin

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:=2 to n do

begin

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

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

end;

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

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

readln

end.

Bình luận (0)
Nguyễn Kim Trí
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 3 2022 lúc 22:42

#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;

}

Bình luận (0)
Hắc Lang
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:02

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.

Bình luận (1)