Help with using empty strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help with using empty strings

So I have a program that returns the smallest amount of coins necessary to get the number entered by the user, and now I'm supposed to modify the program to display quarters when necessary instead of always saying quarter. I'm supposed to use empty strings to do this, can someone help? Thanks! https://code.sololearn.com/WWuH1Uln935H/#html

27th Apr 2017, 4:22 PM
Zac Parnell
Zac Parnell - avatar
2 Answers
+ 9
var plural = ""; if(totalq > 1) plural += "s"; Then print the plural string at the end of "quarter(s)". So: "quarter"+plural+...etc
27th Apr 2017, 4:37 PM
Rrestoring faith
Rrestoring faith - avatar
0
Thanks!
27th Apr 2017, 4:36 PM
Zac Parnell
Zac Parnell - avatar