Close

Printing a cross with given word

Given a string we have to print the characters of that string into a cross mark.
If the string is “12345”, we need to print

1 5
2 4
3
2 4
1 5

This is printing the two diagonals of a square matrix filled the given string. Following is the simple code to print the same.
 

Leave a Reply

Your email address will not be published. Required fields are marked *