Câu 1:
uses crt;
const fi='nguon.txt'
var f1:text;
a,b,c:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
assign(f1,fi); rewrite(f1);
writeln(f1,a);
writeln(f1,b);
writeln(f1,c);
close(f1);
readln;
end.
Câu 2:
const fi='nguon.txt'
fo='kq.txt'
var f1,f2:text;
a,b,c,max,min:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a);
readln(f1,b);
readln(f1,c);
writeln(f2,(a+b+c)/3:4:2);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln(f2,max);
min:=a;
if min>b then min:=b;
if min>c then min:=c;
writeln(f2,min);
close(f1);
close(f2);
end.