0

i have to write a program where i input two positive integers (L and H) which are both less than 21. the program then prints out a box of solid asterisks wit L horizontal asterisks and H vertical asterisks.

i dont really know where to start... can someone tell me?

3
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by yellowSnow
0

Create two int variable.
Ask user for input
Check if input is valid
if so the proceed else go back to get user input
start a for loop from i = 0; i < L;
start another loop ( nested loop ) that ranges from j = 0; k < H
print out a symbol, in your case its an "*";
after the second nested loop is done, print a new line character to start
the new process in a different line.

Then you are done.

0

Create two int variable.
Ask user for input
Check if input is valid
if so the proceed else go back to get user input
start a for loop from i = 0; i < L;
start another loop ( nested loop ) that ranges from j = 0; k < H
print out a symbol, in your case its an "*";
after the second nested loop is done, print a new line character to start
the new process in a different line.

Then you are done.

Just one pedantic point.
The ordering of the loops should probably be:

loop from 0 to < H
    loop from 0 to < L (nested loop)

Cheers,
JD

This topic has been dead for over six months. 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.