K
Khách

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.

31 tháng 8 2018

Var f1, f2: text;

  Tong, m, n, i: integer;

Begin

  assign(f1, ‘DULIEU.TXT’);

  reset(f1);

  assign(f2, ‘KETQUA’);

  rewrite(f2);

  Tong;= 0;

  read(f1, m, n);

  for i:= m to n do

  if i mod 2 = 0 then Tong:= Tong+i;

  write(f2, Tong);

  close(f1);

  close(f2);

End.

22 tháng 7 2021

Uses crt;
var f1,f2:text;
    i,n,tong,tongchan,dem:integer;
    tb:real;
Begin
 clrscr;
 Assign(f1,'DAYSO.txt');
 Assign(f2,'KETQUA.txt');
 reset(f1);dem:=0;tong:=0;tongchan:=0;
 While Not EOF(f1) do
  Begin
  read(f1,i);
  inc(tong,i);
  If i mod 2 = 0 then
    begin
    inc(dem);
    inc(tongchan,i);
    end;
  End;
 tb:=tongchan/dem;
 close(f1);
 rewrite(f2);
 writeln(f2,tong);
 writeln(f2,tongchan);
 writeln(f2,tb:0:2);
 close(f2);
 write(tong);
 readln;
End.

const fi='diem.txt';
fo='kq.txt';
var f1,f2:text;
hs1,hs2,hs3:array[1..100]of integer;
dem1,dem2,dem3,t1,t2,t3,i,sc:integer;
kq:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem1:=0;
while not eoln(f1) do
begin
inc(dem1);
read(f1,hs1[dem1]);
end;
readln(f1);
dem2:=0;
while not eoln(f1) do
begin
inc(dem2);
read(f1,hs2[dem2]);
end;
readln(f1);
dem3:=0;
while not eoln(f1) do
begin
inc(dem3);
read(f1,hs3[dem3]);
end;
t1:=0;
for i:=1 to dem1 do
t1:=t1+hs1[i];
t2:=0;
for i:=1 to dem2 do
t2:=t2+(2*hs2[i]);
t3:=0;
for i:=1 to dem3 do
t3:=t3+(3*hs3[i]);
sc:=dem1+dem2*2+dem3*3;
kq:=(t1+t2+t3)/sc;
writeln(f2,kq:4:1);
close(f1);
close(f2);
end.

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

m,n,i,t:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,m,n);

t:=0;

for i:=m to n do 

 if i mod 2=0 then t:=t+i;

writeln(f2,t);

close(f1);

close(f2);

end.

11 tháng 12 2018

Var f1, f2: text;

  Tong, m, n, i: integer;

Begin

  assign(f1, ‘DULIEU.TXT’);

  reset(f1);

  assign(f2, ‘KETQUA’);

  rewrite(f2);

  Tong;= 0;

  read(f1, m, n);

  for i:= m to n do

  if i mod 2 = 0 then Tong:= Tong+i;

  write(f2, Tong);

  close(f1);

  close(f2);

End.

25 tháng 6 2018

Var f1, f2: text;

  Tong, m, n, i: integer;

Begin

  assign(f1, ‘DULIEU.TXT’);

  reset(f1);

  assign(f2, ‘KETQUA’);

  rewrite(f2);

  Tong;= 0;

  read(f1, m, n);

  for i:= m to n do

  if i mod 2 = 1 then Tong:= Tong+i;

  write(f2, Tong);

  close(f1);

  close(f2);

End.

7 tháng 4 2019

Var f1, f2: text;

  Tong, m, n, i: integer;

Begin

  assign(f1, ‘DULIEU.TXT’);

  reset(f1);

  assign(f2, ‘KETQUA’);

  rewrite(f2);

  Tong;= 0;

  read(f1, m, n);

  for i:= m to n do

  if i mod 2 = 0 then Tong:= Tong+i;

  write(f2, Tong);

  close(f1);

  close(f2);

End.

const fi='diem.txt';
fo='kq.txt';
var f1,f2:text;
hs1,hs2,hs3:array[1..100]of integer;
dem1,dem2,dem3,t1,t2,t3,i,sc:integer;
kq:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem1:=0;
while not eoln(f1) do
begin
inc(dem1);
read(f1,hs1[dem1]);
end;
readln(f1);
dem2:=0;
while not eoln(f1) do
begin
inc(dem2);
read(f1,hs2[dem2]);
end;
readln(f1);
dem3:=0;
while not eoln(f1) do
begin
inc(dem3);
read(f1,hs3[dem3]);
end;
t1:=0;
for i:=1 to dem1 do
t1:=t1+hs1[i];
t2:=0;
for i:=1 to dem2 do
t2:=t2+(2*hs2[i]);
t3:=0;
for i:=1 to dem3 do
t3:=t3+(3*hs3[i]);
sc:=dem1+dem2*2+dem3*3;
kq:=(t1+t2+t3)/sc;
writeln(f2,kq:4:1);
close(f1);
close(f2);
end.

10 tháng 5 2023

with open('XAU.INP', 'r') as input_file, open('XAU.OUT', 'w') as output_file:

        for line in input_file:

                length = len(line.strip())

                output_file.write(f'{length}\n')