I will be building a program that with calculate the usable are in square feet of a house. The calculation will take into account a house with a total of 4 rooms with each room being a rectangular. The program will include user input for each of the room’s length and width. Based on that input, the program will calculate the total square feet for each room then add them to get the total square feet ...view middle of the document...
One input will include the amount of rooms the user chooses (1-4). A printf statement will request the number of rooms in the house. Based on that, the program will require an input of the length and width of each room. Another printf statement will ask the user to input the length and width for each room.
Considering that the square foot of a room is calculated by multiplying the length * width, the program will multiple the length and width of each room (Room1= Length1*width1, Room2=Length2*Width2, etc…), add each total (depending on the amount of rooms, Room1+Room2+Room3, etc…), and output the answer of adding up all the rooms as the total square feet for the house.
We will declare the following variables as an int (int rooms, area, length, width, i;)
rooms – this will be for how many rooms the house will have (1-4)
area – this will be used to add together the area of each room
length – the length of the room
width – the width of the room
i – this will be the loop counter for the number of rooms in the house