program hhh; Uses Crt; Var n,i,max: integer; a: array [1..100] of integer; begin clrscr; write(‘Nhap do dai cua day so: ‘); readln(n); for i:=1 to n do begin write(‘Nhap so thu ‘,i,’: ‘); readln(a[i]); end; max:=a[1]; for i:=2 to n do if max<a[i] then max:=a[i]; writeln(‘Gia tri lon nhat cua day so la: ‘,max); readln end.
program lon_nhat;
uses crt;
var A:array[1..1000] of integer;
n,i,max:integer;
begin
clrscr;
write(‘Nhap N: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]);
end;
max:=A[1];
for i:=2 to n do
if A[i]>max then max:=A[i];
write(‘So lon nhat la: ‘,max);
readln;
end.
Đáp án:
program hhh;
Uses Crt;
Var n,i,max: integer;
a: array [1..100] of integer;
begin
clrscr;
write(‘Nhap do dai cua day so: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(a[i]);
end;
max:=a[1];
for i:=2 to n do if max<a[i] then max:=a[i];
writeln(‘Gia tri lon nhat cua day so la: ‘,max);
readln
end.
bạn kt xem có phải vậy ko ạ
nhớ vote mình 5 sao và ctlhn ạ 🙂