5. Write a program to calculate and display distance travelled by a car if the initial odometer reading is 3450 and the current odometer reading is 3512
Answers
Answered by
0
Answer:
public class Main
{
public static void main(String[] args) {
int initialDistance = 3450;
int finalDistance = 3512;
int distanceTravelled = finalDistance - initialDistance;
System.out.println("The distance travelled is " + distanceTravelled + "km");
}
}
Explanation:
Similar questions