0
Help me please!
You are making a program for a bus service. A bus can transport 50 passengers at once. Given the number of passengers waiting in the bus station as input, you need to calculate and output how many empty seats the last bus will have. Sample Input: 126 Sample Output: 24 Explanation: The first bus will transport 50 passengers, leaving 126-50=76 in the station. The next one will leave 26 in the station, thus, the last bus will take all of the 26 passengers, having 50-26=24 seats left empty.
3 Answers
+ 3
yes, where are you stuck?
where is your code?
no code == no help ^^
+ 2
You can use the modulo operator to find the divisible remainder of num % 50 and subtract that value from 50 to find the the number of empty seats.
For example if the sample input was 126,
126 % 50 = 26
50 - 26 = 24
If you have further issues please post your current code and describe your issue.
+ 1
Mohamed Ahmed Al-Shrafi why posting the solution?
if it may help to solve, it doesn't help to learn (practices are essential) ^^