Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Nested Loop Help

nested loop loop

  • Please log in to reply
1 reply to this topic

#1 Kragen831

Kragen831

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 22 February 2011 - 01:52 PM

Hello!! I am desperate for help to create a nested loop
the out put looks like this.
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000

If anyone can help or guide me through this I'll thank you forever!!
Also this output
***** ////////// *****
**** ////////\\ ****
*** //////\\\\ ***
** ////\\\\\\ **
* //\\\\\\\\ *
\\\\\\\\\\
using a method public static void figure(int figureSize))!! ^^^^^^
  • 0

#2 mnirahd

mnirahd

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 328 posts

Posted 23 February 2011 - 07:43 PM

Hi,

for

99999888887777766666555554444433333222221111100000

You can see that you have to print digits from 0-9, each digit is repeated 5 times:

  for (int i = 0;  i <= 9; i++)
     for (int j = 0; j <=5; j++)
        System.out.println(i);
  System.out.println("");

I ll leave the second part to solve it yourself using the same logic. Try it and let us know!

-Munir
  • 0





Also tagged with one or more of these keywords: nested loop, loop

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download