Question: . Length Converter 0 1 . 0 2 . 4 0 Problem Statement You are given two integers unit and km . Your task is

. Length Converter
01.
02.
40
Problem Statement
You are given two integers unit and km. Your task is to convert input kilometre km value as follows:
If unit 1, then convert kilometre to metre where 1km 1000m
If unit 2, then convert kilometre to centimetre where Ikm 100000cm
If unit 3, then convert kilometre to millimetre where 1km 1000000mm
Print the converted value.
Input Format:
The input consists of a single line:
The line contains two integers unit and km
The input will be read from the STDIN by the candidate
Output Format:
Print the converted value.
The output will be matched to the candidate's output printed on the STDOUT
Constraints:
15 unit 3.
15 km <=10
Example:
Input:
12 Output:
2000
Explanation:
Since unit 1, kilometre is converted to metre, metre 210002000. Thus, output is 2000.
Sample input 242
Sample Outp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!