107k views
5 votes
Given the variables costOfBusRental and maxBusRiders of type int , write an expression corresponding to the cost per rider (assuming the bus is full). (Do not worry about any fractional part of the expression-- let integer arithmetic, with truncation, act here.)

1 Answer

5 votes

Answer:

int costOfBusRental;

int maxBusRiders;

int costPerRider;

costPerRider = costOfBusRental/maxBusRiders;

Step-by-step explanation:

The costPerRider is the total cost of renting the bus (costofBusRental) divided by all the bus users (maxBusRiders). So we declare the three variables to be of type int as required by the question.

User Samadadi
by
5.0k points