write a c++ program to produce following design | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

write a c++ program to produce following design

ZYXWVWXYZ ZYXWXYZ ZYXYZ ZYZ Z

13th Feb 2017, 8:29 AM
akashlina dewanjee
akashlina dewanjee - avatar
2 Answers
+ 3
Your char array is initially [Z, Y, X, W, V] You can use 2 for loops to iterate the array left to right and right to left (not including the last char) inorder to write ZYXWVWXYZ Then shift the first 4 chars one position to the right and replace the first with a space. REPEAT UNTIL YOU HAVE ONLY WHITE SPACES IN YOUR CHAR ARRAY
13th Feb 2017, 11:19 AM
seamiki
seamiki - avatar
+ 1
This pattern is known as palindrome triangle pattern where every row is a palindrome string of odd numbers of characters. In Nth row the number of characters will be 2N+1. Here s a similar C program to print palindrome triangle pattern http://www.techcrashcourse.com/2016/02/c-program-to-print-palindrome-triangle-pattern.html http://www.techcrashcourse.com/2016/02/c-program-to-print-triangle-pyramid-star-pattern.html
15th Apr 2017, 5:07 AM
Arun Kumar
Arun Kumar - avatar