How to repeat a string n number of times | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to repeat a string n number of times

the n is an int and you must repeat what the str says n times.. but only the first 3 chars in the string.

31st Jul 2016, 1:31 PM
Ashmeen Cloete
Ashmeen Cloete - avatar
2 Answers
0
Take the output into the loop hope it helps
31st Jul 2016, 5:44 PM
Lisa Kostyshina
Lisa Kostyshina - avatar
0
Yeah put it in a loop. you will probably want to convert the String to a char array if you only want the first 3 letters.
31st Jul 2016, 5:56 PM
Barra
Barra - avatar