0

hello~

Write a program that will display a pattern depending on n. Assume n as a one digit odd number.

Example: if n=9, display
*000*000*
0*00*00*0
00*0*0*00
000***000

how will i start doing this type of problem? ^^

3
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by kyumi419
0

Start by making a subset of the pattern:

*0000000*
0*00000*0
00*000*00
000*0*000

This is easier to visualize with two counters to mark the stars. After you get this one, you can add the central star that does not ever move.

0

.........................

Edited by kyumi419: n/a

0

can you show me the codes? ^^

No. This is a simple homework problem, and Daniweb's homework policy is not to give code examples without proof of effort.

0

No. This is a simple homework problem, and Daniweb's homework policy is not to give code examples without proof of effort.

ok! got it~
:twisted:
:D

0

Have a left, middle, and end variable. Make middle static.

Move left up 1, move end down 1. If left == mid || right == mid then stop.

0

Move left up 1, move end down 1. If left == mid || right == mid then stop.

You can also do away with the middle variable because that case is identical to when left == right .

0

Have a left, middle, and end variable. Make middle static.

Move left up 1, move end down 1. If left == mid || right == mid then stop.

is that possible to create in each line?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.