- 1

How can you write a program that can convert distance in miles to kilometers?

22nd Jan 2022, 10:47 AM
Lillian Mwanza
2 Answers
+ 1
Please do not put links in the tag section – we cannot follow the link. Rather tag the relevant programming language and put your link in the description
22nd Jan 2022, 10:57 AM
Lisa
Lisa - avatar
+ 1
1 mile = 1.609 kilometres Can't make a program asking for miles and converting it into kms?? Okay, lets take another example, kilometres to meters, ok? 1kilometer = 1000meters So if i input 1.6 then i would multiply it by how much??by 1000meters So output: 1600 meters Ok, so we have done kms to ms Now do the same for to convert a given input (as float or int) to kilometres! Simple!
22nd Jan 2022, 11:07 AM
NEZ
NEZ - avatar