pascal: tạo tệp SONGUYEN.DAT gồm N số nguyên 18/07/2021 Bởi Kylie pascal: tạo tệp SONGUYEN.DAT gồm N số nguyên
program tao_tep; uses crt; var f:text; n,i,k:integer; begin clrscr; Assign(f,’SONGUYEN.DAT’); rewrite(f); write(‘Nhap N: ‘); readln(n); for i:=1 to n do begin write(‘Nhap so thu ‘,i,’: ‘); readln(k); write(f,k,’ ‘); end; close(f); end. Bình luận
var f: text; n, i: byte; a: integer; Begin Assign(f, ‘songuyen.dat’); rewrite(f); Write(‘nhap n = ‘); readln(n); For i:=1 to n do Begin Write(‘nhap so thu ‘, i, ‘: ‘); Readln(a); write(f, a, ‘ ‘); End. Close(f); End. Bình luận
program tao_tep;
uses crt;
var f:text;
n,i,k:integer;
begin
clrscr;
Assign(f,’SONGUYEN.DAT’); rewrite(f);
write(‘Nhap N: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(k);
write(f,k,’ ‘);
end;
close(f);
end.
var f: text;
n, i: byte;
a: integer;
Begin
Assign(f, ‘songuyen.dat’); rewrite(f);
Write(‘nhap n = ‘); readln(n);
For i:=1 to n do
Begin
Write(‘nhap so thu ‘, i, ‘: ‘);
Readln(a); write(f, a, ‘ ‘);
End.
Close(f);
End.