Cho tệp dulieu.dat chứ số nguyên x,y. Viết công thức tập tệp có tên KQ.dat chứ các số nguyên chia hết cho 3 15/08/2021 Bởi Josephine Cho tệp dulieu.dat chứ số nguyên x,y. Viết công thức tập tệp có tên KQ.dat chứ các số nguyên chia hết cho 3
const fi=’dulieu.dat’; fo=’KQ.dat’; var x,y:longint; begin assign(input,fi);reset(input); readln(x,y);close(input); assign(output,fo);rewrite(output); if x mod 3 =0 then write(x,’ ‘); if y mod 3=0 then write(y);close(output); end. Bình luận
program LN;uses crt;var f,f2:text; x,y:integer;beginclrscr;assign(f,’dulieu.dat’);reset(f);assign(f2,’kq.dat’);rewrite(f2);read(f,x,y);if x mod 3 = 0 then write(f2,x);if y mod 3 = 0 then write(f2,y);close(f2);end. Bình luận
const fi=’dulieu.dat’;
fo=’KQ.dat’;
var x,y:longint;
begin
assign(input,fi);
reset(input);
readln(x,y);
close(input);
assign(output,fo);
rewrite(output);
if x mod 3 =0 then write(x,’ ‘);
if y mod 3=0 then write(y);
close(output);
end.
program LN;
uses crt;
var f,f2:text;
x,y:integer;
begin
clrscr;
assign(f,’dulieu.dat’);
reset(f);
assign(f2,’kq.dat’);
rewrite(f2);
read(f,x,y);
if x mod 3 = 0 then write(f2,x);
if y mod 3 = 0 then write(f2,y);
close(f2);
end.