Những câu hỏi liên quan
33. PHAN THỊ HỒNG THẮM 1...
Xem chi tiết
Nguyễn Đức Anh Khoa
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 1 2021 lúc 12:30

const fi='tong.inp'

fo='tong.out'

var f1,f2:text;

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

n,i,t:integer;

begin

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

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

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

Bình luận (0)
Trí Minh
Xem chi tiết
Dương Hữu Thành
Xem chi tiết
Hậuu
Xem chi tiết
Nguyễn Lê Phước Thịnh
27 tháng 4 2021 lúc 20:58

const fi='data.inp'

fo='kq.out'

var f1,f2:text;

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

i,n,t:integer;

begin

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

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

n:=0;

while not eoln(f1) do 

  begin

inc(n);

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t/n:4:2);

close(f1);

close(f2);

end.

Bình luận (0)
Tran Ngô
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 2 2021 lúc 13:39

const fi='data.txt'

fo='tbc.txt'

var f1,f2:text;

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

n,i,t: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]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t/n:4:2);

close(f1);

close(f2);

end.

Bình luận (1)
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)
Mạnh Cường Đào Huỳnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 5 2022 lúc 23:55

const fi='input.txt'

fo='output.txt'

var f1,f2:text;

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

i,n,t:integer;

begin

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

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

n:=0;

while not eof(f1) do 

begin

inc(n);

read(f1,a[n]);

end;

t:=0;

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

write(f2,t);

close(f1);

close(f2);

end.

Bình luận (0)
Lê Tràn Diễm My
Xem chi tiết
SukhoiSu-35
3 tháng 3 2021 lúc 20:42

a)

PROGRAM BAI1a;

VAR N, Tle, Tchan: integer;

BEGIN

          Write ('Nhap N =');

          Readln (N);

          If (N mod 2) = 0 Then

          Tle := N*((N - 2)/2 + 1)/2;

          Tchan := (N + 2)*((N - 2)/2 + 1)/2;

          If (N mod 2) = 1 Then

          Tle := (N + 1)*((N-1)/2 +1)/2;

          Tchan := (N + 1)*((N - 3)/2 + 1)/2;

          WRITELN ('Sle =', Sle, 'Schan =', Schan);

          READLN;

          END.

Bình luận (3)
Bùi Anh Tuấn
3 tháng 3 2021 lúc 20:44

Bình luận (2)
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 21:17

uses crt;

const fi='tong5.txt'

var f1:text;

n,i,t:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

write('Nhap n='); readln(n);

t:=0;

for i:=1 to n do

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

writeln(f1,t);

close(f1);

readln;

end.

Bình luận (0)