Where I make bug ?? 12 capacity of bus 4198576 passenger at station empty seat left 38 how is possible | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Where I make bug ?? 12 capacity of bus 4198576 passenger at station empty seat left 38 how is possible

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 https://code.sololearn.com/cjjUIPfw29MB/?ref=app https://code.sololearn.com/cjjUIPfw29MB/?ref=app https://code.sololearn.com/cjjUIPfw29MB/?ref=app https://code.sololearn.com/cjjUIPfw29MB/?ref=app https://code.sololearn.com/cjjUIPfw29MB/?ref=app

20th Dec 2020, 4:26 AM
Raghvendra Singh chandel
Raghvendra Singh chandel - avatar
5 Respostas
+ 4
Raghvendra Singh chandel For input "41987 12" Total number of seats remain is 11 according to your code only.
20th Dec 2020, 4:49 AM
Arsenic
Arsenic - avatar
+ 2
Your code standalone works perfectly. But that's now what this question wants. For sample input -> 126 Your program should strictly output -> 24 āš ļø Nothing more, nothing less. In its current State it is bound to take 2 inputs and display much more than required on the console. here is the fix (I have just commented out useless lines from your program) šŸ‘‡ https://code.sololearn.com/cTcwe3KsfHo5/?ref=app
20th Dec 2020, 4:42 AM
Arsenic
Arsenic - avatar
0
Output 38 seat left but capacity of bus is only 12 so how it is possible
20th Dec 2020, 4:44 AM
Raghvendra Singh chandel
Raghvendra Singh chandel - avatar
0
Arsenic but required output is 38 how is possible??
20th Dec 2020, 4:54 AM
Raghvendra Singh chandel
Raghvendra Singh chandel - avatar
0
Good job, your code i a lot robust on the fact that the paramaters it can take in are the size seat capacity of a bus and the num. of passengers as well in order to calculate the amount of buses needed. Since the task is to find the amount of seats left on the last bus, the project pretty much wants you to get familiar the modulos operator. Helpful code: x = Passengers % 50 Then seats left = 50 - x
20th Dec 2020, 3:13 PM
Giovanni