A student's school is at a distance of 5 km 350 m from her house. She travels 1 km 70 m on foot and the
rest by bus. Write a program to determine how much distance she travels by bus.
(Hint: Use constant, 1 km - 1000 meters)
Answers
Answered by
3
Answer:
The code below is in Basic. Let me know if you need in any other language.
'First we will convert the distances to the same unit i.e. meters
Dim distanceToSchool as integer = (5*1000)+350
Dim distanceTraveledOnFoot as integer = (1*1000)+70
Dim distanceTraveledByBus as integer = distanceToSchool - distanceTraveledOnFoot
Print ("Total distance traveled by bus: " + distanceTraveledByBus + " meters")
This will print "Total distance traveled by bus: 4280 meters
Explanation:
hope i help you so much
Similar questions