Question: C LANGUAGE 3. [50 pts] Complete the following function by writing C statements that correspond to the description in each comment in the code. Hinclude

C LANGUAGE

C LANGUAGE 3. [50 pts] Complete the following function by writing Cstatements that correspond to the description in each comment in the code.

3. [50 pts] Complete the following function by writing C statements that correspond to the description in each comment in the code. Hinclude int main II Declare a floating point variable to store a rectangle's width II Declare a floating point variable to store a rectangle's length l Declare a third floating point variable that will store the area of the rectangle. II Prompt the user to enter a width for the rectangle. Il Get the user's input, and store it in your previously declared variable for width Il Prompt the user to enter a length for the rectangle. II Get the user's input, and store it in your previously declared variable for length II Using an if statement, print out "Error: invalid side length" if either length or width are Il less than or equal to O. ll El II Calculate the area of the rectangle as a product of length times width, and store the I/ result in your variable for storing the area. l Print "The area of a rectangle with sides and to the screen. II Replace , , and with the value of the associate variables. se. int main0 II Declare a floating point variable to store a rectangle's width I Declare a floating point variable to store a rectangle's length II Declare a third floating point variable that will store the area of the rectangle. Il Prompt the user to enter a width for the rectangle. II Get the user's input, and store it in your previously declared variable for width Prompt the user to enter a length for the rectangle II Get the user's input, and store it in your previously declared variable for length II Using an if statement, print out "Error: invalid side length" if either length or width are ll less than or equal to 0. II Else... II Calculate the area of the rectangle as a product of length times width, and store the II result in your variable for storing the area. Print "The area of a rectangle with sides and is to the screen Il Replace , , and with the value of the associate variables. II All floating point values should be printed out with 1 decimal place of precision. return 0

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 Databases Questions!