Viet chuong trinh nhap vao mot mang b gom n phan tu in cac phan tu vua nhap tim so lon nhat cua mang 18/07/2021 Bởi Ximena Viet chuong trinh nhap vao mot mang b gom n phan tu in cac phan tu vua nhap tim so lon nhat cua mang
program so_max; uses crt; var B:array[1..1000] of integer; n,i,max:integer; begin clrscr; write(‘Nhap n: ‘); readln(n); for i:=1 to n do begin write(‘B[‘,i,’]= ‘); readln(B[i]); end; max:=B[1]; for i:=1 to n do begin if B[i]>max then max:=B[i]; write(B[i],’ ‘); end; writeln; write(‘So lon nhat la: ‘,max); readln; end. Bình luận
var b: array[1..250] of integer; max: integer; n, i: byte; Begin Write(‘n = ‘); readln(n); For i:=1 to n do Begin Write(‘b[‘, i, ‘] = ‘); readln(b[i]); If i=1 then max:=b[1] Else if b[i]>max then max:=b[i]; End; Writeln(‘so lon nhat: ‘, max); Writeln(‘cac so vua nhap:’); For i:=1 to n do write(b[i], ‘ ‘); Readln End. Bình luận
program so_max;
uses crt;
var B:array[1..1000] of integer;
n,i,max:integer;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
for i:=1 to n do
begin
write(‘B[‘,i,’]= ‘); readln(B[i]);
end;
max:=B[1];
for i:=1 to n do
begin
if B[i]>max then max:=B[i];
write(B[i],’ ‘);
end;
writeln;
write(‘So lon nhat la: ‘,max);
readln;
end.
var b: array[1..250] of integer;
max: integer;
n, i: byte;
Begin
Write(‘n = ‘); readln(n);
For i:=1 to n do
Begin
Write(‘b[‘, i, ‘] = ‘); readln(b[i]);
If i=1 then max:=b[1]
Else if b[i]>max then max:=b[i];
End;
Writeln(‘so lon nhat: ‘, max);
Writeln(‘cac so vua nhap:’);
For i:=1 to n do write(b[i], ‘ ‘);
Readln
End.