is it possible to print out the patter below using one and only one for loop in one dialog box? Do not use nested for loops. Use only one for loop, not two or more. Do not use any other kind of loop. Do not use a switch/case statement or if conditions.
I can print it using nested loop, while loop and so forth and i'm having a challenge trying to print it using one for loop only.
Surely that produces the pattern 7 times over.
There is a way to do it with concatenation but you need to use 2 separate Strings, one to hold the growing line of asterisks and one to concatenate each line of asterisks to.
Amir Ahmed wrote:Hello Steve, thanks for your response. As i'm really new to java, i was wondering if there is any way you can write the code for your suggestions because im having a hard time doing so. Thanks again!
In the future, please UseTheForumNotEmail (or mooseages), thanks. We are NotACodeMill here at the ranch. We will try to help you but won't give you the code. I gave some hints on the first three ideas that came to mind, and Tony gave another great idea. Pick one and try to implement it. Then we can help you with specific questions you might have.
Joined: Feb 19, 2013
Thanks for your responses guys! I really appreciate it.
Tony, i used your two strings suggestion and it was much easier than i thought.