+ 4
1. You don't need the if else statement at at. 1 line is all you need after getting the number of passengers.
2. How do you expect this line to work;
int z=y-(x%y);
when you are getting the value for x after it and not before?
FYI, the r-value of that statement is all you need to output.
0
Koloroj
Why you are writing if else even you can get solution in few lines.
Just do
int seats = 50 - passengers % 50;
cout << seats;
Where passengers is input.