Write a program that displays a table of pounds and equivalent weights in kilograms. You can find the conversion factor online if necessary. Store this factor in a properly named constant. Allow the user to specify the range of pounds for the table by prompting for the start, stop, and step values for the pounds column. Display the pounds accurate to two decimal places centered in a column 10 characters wide. The kilometers should display accurate to three decimal places and right-aligned in a column 12 characters wide (see page 75-78). Column headings should be displayed with the same alignments. See Sample Output.
Write a
As no output is provided and no language is specified, I have written the program in Python
The code is:
pound_in_kg=0.45359237;
start=float(input("Enter the start value:\n"))
stop=float(input("Enter the stop value:\n"))
step=float(input("Enter the step value:\n"))
print("Pounds".center(10,' '),"Kolograms".rjust(12,' '));
i=start
while(i<=stop):
print("{:^10.2f}".format(i)+"{:12.3f}".format(i*pound_in_kg))
i=i+step
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images