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
7 Antworten
- 3
Have you checked it
It isn't
+ 6
This works good. What do you mean with broken?
+ 5
The code works, but you have to read the task again und thing about what is there asked and output this.
+ 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).
+ 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
+ 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“.
+ 1
Thank you so much Yamin Mansuri