Easy octagons P87198


Statement
 

pdf   zip

html

Write a program that for every given n prints an “octagon of size n” according to the pattern shown in the examples.

Input

Input consists in several natural numbers n ≥ 2.

Output

For every n, print an “octagon of size n” using capital exes. Do not print any space to the right of the exes. Print an empty line after each octagon.

Public test cases
  • Input

    2
    3
    4
    

    Output

     XX
    XXXX
    XXXX
     XX
    
      XXX
     XXXXX
    XXXXXXX
    XXXXXXX
    XXXXXXX
     XXXXX
      XXX
    
       XXXX
      XXXXXX
     XXXXXXXX
    XXXXXXXXXX
    XXXXXXXXXX
    XXXXXXXXXX
    XXXXXXXXXX
     XXXXXXXX
      XXXXXX
       XXXX
    
    
  • Information
    Author
    Jordi Cortadella
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python