Calculating Area
Back to the Program-A-Day homepage
ProblemYou have decided it's time to replace the carpet in your living room. The first step is to buy the correct amount of carpet for the area. To calculate the area, you must first measure the length and width of the living room. The area can then be calculated from these measurements, giving you the total square footage. The carpet you want costs $5 per square foot. Your task is to write a small program that will accept as input the length and width (as integers) of a room. The program must then calculate the total cost of carpeting by multiplying the square footage by the price per square foot. Your program will print the total square footage and the total cost. Use the following formulas: Area = Length x Width
|
SideSectionTitle
An image or By Students section | |
---|---|---|
SolutionThe solution... | ||
CodeSolutionCode goes here. Please DO NOT put your code in <pre> tags! |