Write a program to read distance in miles and print in kilometre. (1mile=1.609 km)
Answers
Answered by
13
This program is in Python-
mile = float(input("Enter distance in Miles"))
kilometre = mile * 1.609
print("Distance is " + str(kilometre))
Answered by
6
Convert miles into kilometer:
Output:
Enter total miles: 12.8
Total kilometer in miles: 20.5952
Explanation:
The program to the given question as follows:
Program:
#include <iostream> //defining header file
using namespace std;
int main() //defining main method
{
float miles,total_kilometer; //defining float variable
cout<<"Enter total miles: "; //print message
cin>>miles; //input value by user
total_kilometer = miles * 1.609; //convert value into kilometer
cout<<"Total kilometer in miles: "<<total_kilometer; //print value
return 0;
}
Explanation of the above program:
- In the above C++ language program a first header file in include then defining the main method inside this method two float variable " miles and total_kilometer" is defined.
- The miles variable is used for taking input from the user, and the total_kilometer variable is used the miles variable value to convert its value into kilometers.
- In the next line the print function "cout" is used to print its value.
Learn more:
- Convert meter to kilometer: https://brainly.in/question/11157001
- Conversion in java: https://brainly.in/question/14488473
Similar questions