PascalABC
var
n, k, m: integer;
function binary(n: integer): string;
var i: integer;
a: array[1. . 10] of byte;
s: string;
begin
while n > 0 do
begin
inc(i);
a[i] := n mod 2;
n := n div 2;
end;
for n := i downto 1 do s := s + a[n];
binary := s;
end;
begin
Write('Введите N: '); ReadLn(n);
for k := 0 to round(power(2, n) - 1) do
begin
for m := 1 to n - length(binary(k)) do Write('0');
WriteLn(binary(k));
end;
end.