Những câu hỏi liên quan
Duyvvv
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:42

uses crt;

const fi='dulieu.txt'

var f1:text;

a,b:array[1..100]of integer;

i,n:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

begin

inc(n);

readln(f1,a[n],b[n]);

end;

for i:=1 to n do 

begin

  if a[i]<b[i] then writeln(a[i])

else writeln(b[i]);

end;

readln;

end.

Bình luận (0)
Quỳnh Như
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2022 lúc 23:21

uses crt;

const fi='songuyen.inp'

fo='songuyen2.out'

var a:array[1..100]of integer;

i,n,t1:integer;

f1,f2:text;

begin

clrscr;

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

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

readln(f1,n);

for i:=1 to n do readln(f1,a[i]);

t1:=0;

for i:=1 to n do if a[i] mod 2<>0 then t1:=t1+a[i];

writeln(t1);

writeln(f2,t1);

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

close(f1);

close(f2);

readln;

end.

Bình luận (0)
Yến Chi Phan Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 6:55

uses crt;

const fi='dulieu.dat'

var f1:text;

a,b,p,s: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(a[n],b[n]);

end;

for i:=1 to n do 

  begin

p[i]:=(a[i]+b[i])/2;

s[i]:=a[i]*b[i];

end;

for i:=1 to n do 

  writeln(p[i]:4:2,' ',s[i]:4:2);

close(f1);

readln;

end.

Bình luận (0)
Hân Cao
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 5 2022 lúc 7:46

uses crt;

const fi='dulieu.txt'

var f1:text;

a:array[1..100]of real;

t:real;

i,n:integer;

begin

clrscr;

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

readln(f1,n);

for i:=1 to n do readln(f1,a[i]);

t:=0;

for i:=1 to n do t:=t+a[i];

writeln(t);

close(f1);

readln;

end.

Bình luận (0)
Mĩ Lâm
Xem chi tiết
Nguyên Hưng Trần
22 tháng 7 2021 lúc 21:25

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.

Bình luận (0)
Nguyễn Văn Hùng
Xem chi tiết
Nông trang
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:05

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.

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
11 tháng 12 2018 lúc 4:12

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.

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
25 tháng 6 2018 lúc 3:32

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.

Bình luận (0)