Need help😣 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help😣

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. #include <iostream> using namespace std; int main() { // return 0; }

10th Dec 2020, 11:10 AM
Janiera Raniola
Janiera Raniola - avatar
3 Answers
- 2
#include <iostream> using namespace std; int main() { int p; cin >> p; int c = 0; for(int i=p;i>0;i-=50) { if (i < 50) { cout << 50 - i; break; } } return 0; }
10th Dec 2020, 11:14 AM
Иван Чикyнов
Иван Чикyнов - avatar
+ 3
Иван Чикyнов please don't provide a ready made code to him. i hate to dislike your answer, but i have to
10th Dec 2020, 11:56 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
😥
10th Dec 2020, 12:17 PM
Janiera Raniola
Janiera Raniola - avatar