String length | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

String length

If the string is Adam how can the output be M MM MM MMM (I think it is based on the string length)

26th Jan 2019, 5:07 PM
Altina
Altina - avatar
5 Answers
26th Jan 2019, 7:41 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
What do you want the output to be, exactly? Also, in which language?
26th Jan 2019, 5:12 PM
Zen
Zen - avatar
+ 1
Yes you need the length. And I would use two loops. one for the row: for (int i = 0; i < length; i++){ //inside one for the line for (int j = 0; j < i; j++){ //print the chars } }
26th Jan 2019, 6:10 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Thankyou so much 😍
26th Jan 2019, 9:05 PM
Altina
Altina - avatar
0
Java language, thank you
26th Jan 2019, 6:56 PM
Altina
Altina - avatar