I Like Char Pattern

Author: Efat Sikder

Problem Setter: Md Kamrul Hasan

Member, IUBAT IITS Programming Club

Kamrul likes to draw the pattern in his notebook. Now Kamrul learns programming, he makes some of those patterns by using programming. As a new learner Kamrul cannot make all the patterns he draws in his notebook. So, today Kamrul needs your help to make only one pattern from his notebook.

You need to write a program that will take an integer number and creates this pattern for the corresponding inputs.

For example,

·         If N=5, the pattern print first 5 char look like this,

      a b c d e
      b         d
      c         c
      d         b
      e d c b a

·         If N=10, the pattern print first 10 char look like this,
 a b c d e f g h i j
b                        i
c                        h
d                        g
e                        f
f                        e
g                       d
h                       c
i                        b
j i h g f e d c b a

Input Format

·         You will be given a positive integer N (1 ≤ N ≤ 26) as input.

Output Format

·         Output the pattern

Print a new line after printing the output.


abcde b d c c d b edcba
Language Time Memory
GNU C 11 1s 512MB
GNU C++ 14 1s 512MB
GNU C++ 11 1s 512MB
PHP 7 1s 1024MB
Java (OpenJDK 8) 1s 4096MB
Login To Submit