COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Develop an algorithm to prompt the user for and accept a measurement in centimeters and convert it to inches. Output the measurement in both inches and centimeters. Recall that 1 inch = 2.54cm.Which is the correct way in writing the result for the above program?
|
print “The conversion is", inches, “=", measure
|
|
print “The conversion is inches = measure”
|
|
print “The conversion is” read conversion
|
|
print “The conversion is” inches “=” measure
|
Explanation:
Detailed explanation-1: -To convert inches to centimetres, multiply the given inch value by 2.54 centimetres. For example, to convert 7 inches to centimeters, multiply 7 by 2.54. Therefore, 7 inches is equal to 17.78 cm.
Detailed explanation-2: -1 foot = 30.48 centimeters. So one can convert feet into centimeters by multiplying the number of feet by 30.48.
Detailed explanation-3: -Know the first formula for converting centimeters to inches. The formula is: [number of centimeters] X 0.39 = [number of inches]. This equation means that, using a calculator, you take the number of centimeters you want to convert, multiply them by 0.39 and you will have the number of inches.
There is 1 question to complete.