Uses crt; Var f1,f2:text; i,n,max:integer; a:array[1..100] of integer; Begin Assign(f1,'baitap.txt');reset(f1); Assign(f2,'solonnhat.txt');rewrite(f2); While not eof(f1) do Begin Read(f1,n,a[i]); Max:=a[1]; For i:=2 to n do if a[i]>max then max:=a[i]; End; Writeln(f2,'solonnhatla:',max); Close(f1);close(f2); End.
Đúng 0
Bình luận (0)
uses crt;
var n,max :integer;
f1,f2:text;
begin
clrscr;
assign(f1,'baitap.txt'); reset(f1);
assign(f2,'solonhat.txt'); rewrite(f2);
max:=0;
while not eof(f1) do
begin
read(f1,n);
if max <n then max:=n;
end;
writeln('solonhatla: ',max:5);
write(f2,max);
close(f1);close(f2);
readln;
end.
Đúng 0
Bình luận (0)