Yes, but it seems more natural to calculate the first MPG first and the second MPG second.
Here is the list of data. The program will prompt for and read in each number.
The names you chose for the variables in a program can make the programming easy, or can make it hard and error-prone. The name of a variable should indicate what it is.
For example, the first odometer reading should
be called something like FIRSTMILES
,
since it is the first reading of miles.
Think of a descriptive name for the second odometer reading.