+ 1

"Hello" should print in the console

Depending on user input "e" in "Hello" should be added in the output sentence. Ex:if user input is 4,den in the console "Heeeello" should print, how can i do this. Help to come out of this.

16th Sep 2017, 5:18 PM
vinay megharaj
vinay megharaj - avatar
4 Respostas
+ 4
You print always H and you ask user for e number and do a for from 1 to number where you print e's and next print llo
16th Sep 2017, 5:35 PM
Daniel
Daniel - avatar
+ 4
@Daniel mentioned a 'for' loop. You could also use 'while'. If you wanted to look at SoloLearn's training, loops are covered in SoloLearn's Java training, the second module: "Conditionals and Loops". If you want code examples to adapt to your purpose, you can search CodePlayground: Choose "Most Recent", and "Java", then type "loop" and choose any sample.
16th Sep 2017, 6:07 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
How can i do that in code
16th Sep 2017, 5:37 PM
vinay megharaj
vinay megharaj - avatar