0

Find the passengers at last bus?

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.

8th Dec 2021, 1:38 PM
Bayazid Habib Siddikee
Bayazid Habib Siddikee - avatar
4 Answers
+ 3
Explanation is already given. Show your attempts.
8th Dec 2021, 2:46 PM
A͢J
A͢J - avatar
+ 1
Bayazid Habib Siddikee Do cout << 50 - passengers % 50; There is only one input passengers. You didn't check sample example?
8th Dec 2021, 4:19 PM
A͢J
A͢J - avatar
0
But It's invalid 😑 #include <iostream> using namespace std; int main() { //your code goes here int bus; cin>>bus; int sits=50; int passenger; cin>>passenger; int empty; empty=(sits*bus)-passenger; cout<<empty<<endl; //hoy na kno🙃 return 0; }
8th Dec 2021, 4:03 PM
Bayazid Habib Siddikee
Bayazid Habib Siddikee - avatar
0
Jajakallah khairan😊
8th Dec 2021, 4:30 PM
Bayazid Habib Siddikee
Bayazid Habib Siddikee - avatar