0

Could you please help with this code. It's meant to return the remainder of any input number but it's broken or something

https://code.sololearn.com/cA1gfz1vkyAV/?ref=app

9th Feb 2021, 8:03 AM
Adeolu Oyewo
Adeolu Oyewo - avatar
7 Réponses
- 3
Have you checked it It isn't
9th Feb 2021, 8:08 AM
Adeolu Oyewo
Adeolu Oyewo - avatar
+ 6
This works good. What do you mean with broken?
9th Feb 2021, 8:07 AM
JaScript
JaScript - avatar
+ 5
The code works, but you have to read the task again und thing about what is there asked and output this.
9th Feb 2021, 8:13 AM
JaScript
JaScript - avatar
+ 5
Maybe it is because 50 % 50 = 0 and not 50. In this task, obviously, wanted output is 50 in that case. Try replacing "passengers % 50" with "(passengers % 50 ? passengers % 50 : 50)" (if passengers % 50 is 0, then 50, otherwise passengers % 50; it is trinary "if/else" one-line operator).
9th Feb 2021, 8:44 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 3
https://code.sololearn.com/c8H5Q7KQc3ph/?ref=app Check the remainder If the remainder is 0 then that means 50 passengers are in the last bus
9th Feb 2021, 10:18 AM
Yamin Mansuri
Yamin Mansuri - avatar
+ 2
This is the maybe most important information in this task: „you need to calculate and output how many empty seats the last bus will have“.
9th Feb 2021, 11:47 AM
JaScript
JaScript - avatar
+ 1
Thank you so much Yamin Mansuri
10th Feb 2021, 10:30 PM
Adeolu Oyewo
Adeolu Oyewo - avatar