Can anyone plzz tell me how to use the module operator here?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone plzz tell me how to use the module operator here??

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

2nd Jan 2021, 12:55 PM
Aayush Singh Thakur
Aayush Singh Thakur - avatar
5 Answers
2nd Jan 2021, 12:56 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
You need to get the remainder of input divided by 50 by the '%' operator. Then substract the remainder from 50 and you will get the answer.
3rd Jan 2021, 5:30 AM
Md. Masrafi Bin Seraj
Md. Masrafi Bin Seraj - avatar
+ 3
The answer is 6
3rd Jan 2021, 11:20 PM
Ricardo Montesino
Ricardo Montesino - avatar
+ 2
Do you want the answer of this question?
2nd Jan 2021, 7:15 PM
Atul [Inactive]
+ 1
input % maxPassengers The result is the remsinder after input is divided by maxPassengers 226%50 will result in 24
3rd Jan 2021, 8:59 PM
Christine Jump
Christine Jump - avatar