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.

Recommended Answers

All 4 Replies

Lets see some of your code. Then we will know what areas to help you with.

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.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.