uses crt;
const fi='data.txt';
fo='songuyen.txt';
var f1,f2:text;
a:array[1..100]of integer;
m,i,dem,k:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m);
for i:=1 to m do
read(f1,a[i]);
for i:=1 to m do
if a[i]>0 then write(f2,a[i]:4);
writeln(f2);
write('Nhap so k='); readln(k);
dem:=0;
for i:=1 to m do
if a[i] mod k=0 then inc(dem);
writeln(f2,'So cac phan tu la boi cua ',k,' la: ',dem);
close(f1);
close(f2);
readln;
end.
Đúng 0
Bình luận (0)