PYTHON PROGRAMMING Create a program that will convert a distance taken from the user in kilometers to the following conversion types: Statute mile (SM), Nautical mile (NM) and a Furlong. The conversion between the units are as follows: 1KM = 0.54NM, 1NM = 1.151 SM and 1SM = 8 furlongs The program will read one data value at a time and then convert the value to all three units Example of demo run: Enter linear distance in kilometers (km): 2.5 The distance in NM is: 1.35 The distance in SM is: 1.55385 The distance in Furlong is: 12.4308 End of linear converter program.
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
PYTHON
- Create a program that will convert a distance taken from the user in kilometers to the following conversion types: Statute mile (SM), Nautical mile (NM) and a Furlong. The conversion between the units are as follows:
1KM = 0.54NM, 1NM = 1.151 SM and 1SM = 8 furlongs
- The program will read one data value at a time and then convert the value to all three units
- Example of demo run:
Enter linear distance in kilometers (km): 2.5
The distance in NM is: 1.35
The distance in SM is: 1.55385
The distance in Furlong is: 12.4308
End of linear converter program.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images