Please create the program for below | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please create the program for below

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. I tried hard but i couldn't solve the problem. Yes i know to use remainder and then subtract value from 50.but it shows an error or wrong output

11th Jan 2021, 5:22 AM
Jawahirullah
Jawahirullah - avatar
2 Answers
+ 9
This is a practise problem from the C++ course only and *you* need to complete it, not someone else. I can give you the hint: If you divide the input by 50, the remainder you will get is the number of people travelling in last bus. Now there are 50 seats in a bus, and you have the number of people travelling in the last bus. I think calculating the number of empty seats is easy now.
11th Jan 2021, 5:29 AM
XXX
XXX - avatar
0
No one else solve it for you. You should work hard to solve yourself. Try logic games and quizzes, download apps from internet. Do your best and have a rest😃
11th Jan 2021, 8:00 AM
Hushnudbek
Hushnudbek - avatar