Uses Crt;
Var
  i,j,a : shortint;
Procedure DrawTable(x:integer);
 var y:integer;
 begin
   GotoXY(28,1);
   Write('Таблица умножения до ',x);
   for y := 39-x*2 to x*4 + (40-x*2) do
     begin
       GotoXY(y, 14 - x div 2);
       Write('═');
       GotoXY(y, (15 - x div 2) + x);
       Write('═');
     end;
   Write('╝');
   GotoXY(WhereX - 1, WhereY - x - 1);
   Write('╗');
   For y := 1 to x do
     begin
       GotoXY((37-x*2) + y*4, 13 - x div 2 );
       Write(y)
     end;
   For y := 1 to x do
     begin
       GotoXY((36-x*2), (14 - x div 2) + y);
       if y < 10 then Write(y,'  ║')
       else
         Write (y,' ║');
       GotoXY(WhereX-1, WhereY + 1);
       Write('╚');
       GotoXY((41-x*2)+ x*4 , (14 - x div 2) + y);
         Write ('║')
      end;
   GotoXY(39-x*2, 14 - x div 2);
   Write('╔');
 end; {DrawTable}
Begin
  clrscr;
  Write('Введите число на которое множить, меньшее 18 ');
  Read(a);
  While a > 17 do
    begin
      Writeln('Извините, вы можете ввести только число, меньшее 18 ');
      Read(a)
    end;
  clrscr;
  DrawTable(a);
  For i := 1 to a do
    begin
      for j := 1 to a do
        begin
          GotoXY((37-a*2) + j*4 , (14 - a div 2) + i);
          Write(I*J)
        end;
    end;
  Readln;
  Readln
End.
