i need a code for this!!

Z asterisk pattern!! plsssssssss

The program forms the letter Z by printing n input
character symbols on the upper line, n input character symbols on the lower line, and n input
character symbols on the diagonal line. If the value of n is less than or equal to 2, the program
prints “Cannot create the mark.”.
The input and printing process must be repeated until the user presses n, for stop.

Input a number and a symbol: 5 #
#####
#
#
#
#####
Do you want to continue? [y/n] : y
Input a number and a symbol: 12 *
************
*
*
*
*
*
*
*
*
*
*
************
Do you want to continue? [y/n] : n
Goodbye.

The program forms the letter Z by printing n input
character symbols on the upper line, n input character symbols on the lower line, and n input
character symbols on the diagonal line.

However, down the line, your output shows the drawing for C, not Z... I don't get your problem. Post your code.

Edited 5 Years Ago by tkud: n/a

Steps:

- Get ColumnSize
- Create a 2D array ColumnSize x ColumnSize with each element initialized to ' '(space)
- Populate the First and last column of the 2D array '#'
- for i = ColumnSize - 1 to 0
   - make Array2D[ColumnSize][ColumnSize] = '#'

- Print the whole array

Its more easy to grasp( at least I think so ) if you use the above approach, but using can do this without using array

Edited 5 Years Ago by firstPerson: n/a

use nested for loop; outer loop will print the "#" symbol and inner loop will print spaces from 2nd line. don't forget to reduce the count of inner loop.

This article has been dead for over six months. Start a new discussion instead.