Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
const fi='input.txt';
var f1:text;
a,b,c:array[1..100]of real;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n],b[n],c[n]);
end;
for i:=1 to n do
writeln('Tong cua dong ',i,' la: ',a[i]+b[i]+c[i]:4:2);
for i:=1 to n do
writeln('Trung binh cong cua dong ',i,' la: ',(a[i]+b[i]+c[i])/3:4:2);
close(f1);
readln;
end.
uses crt;
const fi='so.inp';
var f1:text;
a,b:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
while not eof(f1) do
begin
readln(f1,a,b);
writeln((a+b)/2:4:2);
end;
close(f1);
readln;
end.
uses crt;
const fi='kq.txt';
var a:array[1..10]of integer;
i,n:integer;
f1:text;
begin
clrscr;
n:=10;
for i:=1 to n do readln(a[i]);
assign(f1,fi); rewrite(f1);
for i:=1 to n do
begin
if (n%5<>0) then write(f1,a[i]:4);
else writeln(f1);
end;
close(f1);
readln;
end.
Program HOC24;
var i,n: integer;
a: array[1..1000] of integer;
t: longint;
f1,f2: text;
const fi='DATA1.TXT';
fo='KQ1.TXT';
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
for i:=1 to n do if a[i] mod 5=0 then write(f2,a[i],' ');
close(f1); close(f2);
end.
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b,c,d:array[1..100]of integer;
i,n,dem,dem1:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n],b[n]);
end;
dem:=0;
dem1:=0;
for i:=1 to n do
if a[i]>b[i] then
begin
inc(dem);
inc(dem1);
c[dem]:=a[i];
d[dem]:=b[i];
end
else begin
inc(dem);
inc(dem1);
c[dem]:=b[i];
d[dem]:=a[i];
end;
for i:=1 to dem do
write(f2,c[i]:4);
writeln(f2);
for i:=1 to dem1 do
write(f2,d[i]:4);
close(f1);
close(f2);
end.
const fi='hcn.inp';
fo='hcn.out';
var f1,f2:text;
a,b:array[1..100]of integer;
i,j,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
inc(n);
readln(f1,a[n],b[n]);
end;
for i:=1 to n do
writeln(f2,2*(a[i]+b[i]),' ',a[i]*b[i]);
close(f1);
close(f2);
end.
const fi='hcn.inp';
fo='hcn.out';
var f1,f2:text;
a,b:array[1..100]of integer;
i,j,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
inc(n);
readln(f1,a[n],b[n]);
end;
for i:=1 to n do
writeln(f2,2*(a[i]+b[i]),' ',a[i]*b[i]);
close(f1);
close(f2);
end.
uses crt;
const fi='dulieuvao.dat';
var f1:text;
a,b,c,d,e:array[1.1.00]of integer;
n,m,d,x,v,t,t1,t2,t3,t4,t5,i:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eoln(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
readln(f1);
m:=0;
while not eoln(f1) do
begin
inc(m);
read(f1,b[m]);
end;
readln(f1);
d:=0;
while not eoln(f1) do
begin
inc(d);
read(f1,c[d]);
end;
readln(f1);
x:=0;
while not eoln(f1) do
begin
inc(x);
read(f1,d[x]);
end;
readln(f1);
v:=0;
while not eoln(f1) do
begin
inc(v);
read(f1,e[v]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day 1 la: ',t);
t1:=0;
for i:=1 to m do
t1:=1+b[i];
writeln('Tong cua day 2 la: ',t1);
t2:=0;
for i:=1 to d do
t2:=t2+c[i];
writeln('Tong cua day 3 la: ',t2);
t3:=0;
for i:=1 to x do
t3:=t3+d[i];
writeln('Tong cua day 4 la: ',t3);
t4:=0;
for i:=1 to v do
t4:=t4+e[i];
writeln('Tong cua day 5 la: ',t4);
close(f1);
readln;
end.