+ 2

Can someone help me solve

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. https://www.sololearn.com/discuss/3012177/?ref=app

4th Apr 2022, 1:03 PM
Namatovu Najah
10 RĂ©ponses
+ 3
Put your code on sololearn playground: Go to Code section, click +, select c++, Insert your code, save. In this thread, click +, Insert Code, sort for My Code Bits, select your code. This way, other users can test your code and see the syntax highlighting.
4th Apr 2022, 1:25 PM
Lisa
Lisa - avatar
+ 3
1. Read the task description carefully: We need to take the number of passengers and input (hint: cin) – do not hard-code the numbers 2. Only output the resulting number – not any other strings or numbers 3. Look at the hint in the task description, it asks us to use the % operator for the calculation.
4th Apr 2022, 1:41 PM
Lisa
Lisa - avatar
+ 3
Hey! This one is really nice prob Here is the answer of this one acc to me #include <iostream> using namespace std; int main() { int waiting; cin>>waiting; int last; last=waiting%50; cout<<50-last; return 0; } //now here waiting is just the no. of passengers waiting on stand and after taking the passengers, no of passengers waiting for the last time o stand is the integer last... The you can subtract it from 50 to get exact answer 😊
6th Apr 2022, 11:59 AM
Ashish Sharma
Ashish Sharma - avatar
+ 2
What have you tried? Please link your code, so we can help you further. Please DO NOT link threads that are not related to your question.
4th Apr 2022, 1:13 PM
Lisa
Lisa - avatar
4th Apr 2022, 1:34 PM
Namatovu Najah
+ 2
Thanks
4th Apr 2022, 1:34 PM
Namatovu Najah
+ 1
Am sorry but how do I link
4th Apr 2022, 1:21 PM
Namatovu Najah
+ 1
I've tried changing it according to your hint does it correspond to what you meant
4th Apr 2022, 2:49 PM
Namatovu Najah
+ 1
you variable "a" needs to be a user input, not 126. 126 is only an example value. Take input for "a" (cin!!!!!!!!!!!!!!). Only output the result, not any other string!
4th Apr 2022, 3:00 PM
Lisa
Lisa - avatar
+ 1
Ok let me try again
6th Apr 2022, 7:12 PM
Namatovu Najah