C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C++

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

17th Aug 2022, 4:47 PM
AYUSH
AYUSH - avatar
3 Answers
+ 4
Hint: 1. Receive the number of passengers. 2. Calculate the rest of passengers the last bus will have for example with modulo division. 3. Calculate empty seats and output it.
17th Aug 2022, 5:25 PM
JaScript
JaScript - avatar
+ 4
JaScript Show your attempt
17th Aug 2022, 5:27 PM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 3
AYUSH Please share your code
17th Aug 2022, 4:59 PM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar