Những câu hỏi liên quan
Đặng công mạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 3 2022 lúc 9:49

uses crt;

const fi='kq.txt'

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

i,n,dem: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 write(f1,a[i]:4);

writeln(f1);

dem:=0;

for i:=1 to n do  if a[i]>0 then dem:=dem+1;

writeln(f1,dem);

close(f1);

readln;

end.

Đặng công mạnh
Xem chi tiết
Đỗ Tuệ Lâm
10 tháng 3 2022 lúc 16:35

undefined

Dư Dư
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 7:19

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.

Phạm Đức Huy
Xem chi tiết
lê khánh huyền
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 22:53

uses crt;

const fi='kq.txt'

var a:array[1..15]of real;

i,n:integer;

f1:text;

begin

clrscr;

n:=15;

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

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

for i:=1 to n do 

  begin

 if (i mod 5=0) then writeln(f1)

else write(f1,a[i],' ');

end;

close(f1);

readln;

end.

Dương Hữu Thành
Xem chi tiết
Bùi Thị Ngọc
Xem chi tiết
Nguyễn Văn Thường
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2022 lúc 18:51

const fi='input.txt'

fo='soan.txt'

var f1,f2:text;

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

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

for i:=1 to n do 

  if a[i]<0 then writeln(f2,a[i]:4);

close(f1);

close(f2);

end.

Đặng Công
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 5 2021 lúc 20:31

uses crt;

const fi='dl.txt'

fo='soam.txt'

var f1,f2:text;

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

i,n:integer;

begin

clrscr;

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

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

n:=0;

while not eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

for i:=1 to n do 

begin

  if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)

else if a[i]<0 then write(f2,a[i]:4);

end;

close(f1);

close(f2);

readln;

end.