Var i, j, m, n: integer; a, b: array[0..9] of boolean;
begin for i := 0 to 9 do a[i] := true; write('Введите количество чисел: '); read(m); write('Введите числа: '); for i := 1 to m do begin for j := 0 to 9 do b[j] := false; read(n); if n = 0 then a[0] := true; while n <> 0 do begin b[n mod 10] := true; n := n div 10; end; for j := 0 to 9 do a[j] := a[j] and b[j]; end; for i := 0 to 9 do if a[i] then write(i, ' '); end.
i, j, m, n: integer;
a, b: array[0..9] of boolean;
begin
for i := 0 to 9 do a[i] := true;
write('Введите количество чисел: ');
read(m);
write('Введите числа: ');
for i := 1 to m do
begin
for j := 0 to 9 do b[j] := false;
read(n);
if n = 0 then a[0] := true;
while n <> 0 do
begin
b[n mod 10] := true;
n := n div 10;
end;
for j := 0 to 9 do a[j] := a[j] and b[j];
end;
for i := 0 to 9 do if a[i] then write(i, ' ');
end.