The code below is supposed to print "Hello World" however many times the user tells it to. Does it work...

profileheahen

The code below is supposed to print "Hello World" however many times the user tells it to. Does it work correctly? If not, how would you fix it?

 
System.out.print("How many times should I print it? ");
int times = reader.nextInt();
 
for( int i=1; i<times; i++ ){
   System.out.println("Hello World!);
}
    • 11 years ago
    • 5
    Answer(0)
    Bids(0)