Seeing dollars in your future

  • 4
  • unavailable
If you open this task at midnight, take a while loop, and display a 10x10 square of dollar signs, then you'll learn to use a while loop to display a 10x10 square of dollar signs. You shouldn't expect untold riches to immediately follow. But if you keep completing these tasks, they almost certainly will.
You can't complete this task, because you're not signed in.
Comments(3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
SoundaryaLevel 6
15 January, 05:51
import java.io.*; public class Solution { public static void main(String[] args) throws Exception { //write your code here int i=10; int j=10; while(i>=1){ while(j>=1){ //for(j=10;j>=1;j--){ System.out.print("$"); j--; } i--; System.out.println(); } } } Whats wrong with the logic??..its working fine with for loop..but not with while loop The code worked fine when I initialized j value before the start of second while loop. But why cant it work wen initialized in the beginning
RomanLevel 41
15 January, 07:05
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
ZserboLevel 14 , Budapest
8 June, 22:21
you have to reset j value after every outer (i) iteration