Hey guys how can I solve this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Hey guys how can I solve this

You will get the question inside

18th Mar 2021, 12:32 PM
Filimon
Filimon - avatar
17 Answers
+ 3
where is your try?
18th Mar 2021, 12:36 PM
visph
visph - avatar
+ 2
don't mark your own answer as the best ^^
18th Mar 2021, 12:38 PM
visph
visph - avatar
+ 2
if we provide you the code without your own try, you will never learn anything ;)
18th Mar 2021, 1:00 PM
visph
visph - avatar
+ 1
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. Here is the question
18th Mar 2021, 12:33 PM
Filimon
Filimon - avatar
+ 1
technically, it's an answer to your question ;) you must share your coding attempt in order to get helped ^^
18th Mar 2021, 12:41 PM
visph
visph - avatar
+ 1
ok :D you must give a generic solution, working with any input (assume that all input are valid), and only output final result...
18th Mar 2021, 12:46 PM
visph
visph - avatar
+ 1
the task ask for computing how many peoples will be in the last bus. each bus can charge 50 persons you need to compute the rest of integer division of total number of persons by total place in one bus: this give you how many place left in last bus... then you should output total place in one bus minus place left in last bus: int passengers; cin >> passengers; int left = passengers % 50 cout << 50 - left;
18th Mar 2021, 1:18 PM
visph
visph - avatar
+ 1
excuse me: you should only output how many place are left in last bus: cout << left;
18th Mar 2021, 1:19 PM
visph
visph - avatar
0
Ok that was not my answer that's my question
18th Mar 2021, 12:39 PM
Filimon
Filimon - avatar
0
int main() { int x = 126 - 50; cout << x << endl; int y = 76 - 50; cout << y << endl; int z = 50 % 24; cout << z; } Here it's but am just a beginner ok
18th Mar 2021, 12:43 PM
Filimon
Filimon - avatar
0
Can you make it more clear
18th Mar 2021, 12:47 PM
Filimon
Filimon - avatar
0
the task should give you prefilled code with input get from 'cin' use the variable wich store input to compute your solution ;)
18th Mar 2021, 12:49 PM
visph
visph - avatar
0
Ok I will try
18th Mar 2021, 12:50 PM
Filimon
Filimon - avatar
0
you're almost on right way: you need to use % operator, but not exactly as you do ;)
18th Mar 2021, 12:53 PM
visph
visph - avatar
0
But how please give me directly the code
18th Mar 2021, 12:54 PM
Filimon
Filimon - avatar
0
I was try many times but I can't get the correct code but for the first time give me the code and you can give me another question like that and 100% I will do the next question I mean if you are volunteer
18th Mar 2021, 1:04 PM
Filimon
Filimon - avatar
0
Ok thanks a lot
18th Mar 2021, 1:20 PM
Filimon
Filimon - avatar