PROGRAM BigX (Input,Output);

{ Draw an X of user-specified size on the screen }

CONST
  MaxSize = 80;


VAR
  size, row, col :Integer;


BEGIN
  Writeln('Program to draw a big X on the screen');
  Writeln('Enter size of screen (max size is ',MaxSize);

  Readln(size);
  WHILE size > MaxSize DO
    Begin
     Writeln('Invalid size.  Must be less than or equal to: ',MaxSize);
     Writeln('Enter size of screen: ');
     Readln(size);
    End;

  row := 1;
  WHILE row <= size DO            { line by line, (top to bottom) }
   Begin

     col := 1;
     WHILE col <= size DO          { column by column, (left to right) }
      Begin

        { if first row, last row, first column, last column, main diagonal,
         or main counter-diagonal }
        IF (row=1) OR (row=size) OR (col=1) OR (col=size) OR
           (row=col) OR (row+col-1=size) THEN
          Write('*')
        ELSE
          Write(' ');

        IF col = size THEN   { end of line }
          Writeln;

        col := col + 1;

      End;

     row := row + 1;
   End;

END.

     