0

You are making a program for a bus service in c++ please help me do that

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.

2nd Aug 2022, 11:27 AM
Jay Soni
Jay Soni - avatar
4 odpowiedzi
+ 5
Jay Soni , can you modify your post by putting the name of the programming language in the tag list?
2nd Aug 2022, 2:40 PM
Lothar
Lothar - avatar
+ 3
Please use the forum's search facility to find discussion posts bearing similar topics. Considering it's a code coach task, there should be some relevant posts from where you can learn already. The hints and suggestions in the previous discussion posts can help you solve the task P.S. Please avoid writing your question in the poat tags. Tags serve a different purpose ... https://code.sololearn.com/W3uiji9X28C1/?ref=app
2nd Aug 2022, 12:46 PM
Ipang
+ 2
#include <iostream> using namespace std; int main() { int passengers; cout<<"Enter how many passengers are there"<<endl; cin>>passengers; int left_passengers; left_passengers=passengers%50; int empty_seats= 50-left_passengers; cout<<empty_seats<<endl; return 0; }
3rd Aug 2022, 3:30 PM
Jay Soni
Jay Soni - avatar
+ 2
I got the answer thank you everyone for your attention 🙂
3rd Aug 2022, 3:31 PM
Jay Soni
Jay Soni - avatar