If_Statement_Quiz(GroupA and B)

Write a program to calculate and display the area of a rectangle ( The message will be ” The area is xxx.”) . Your program must check if the input values are positive. Otherwise it should print a message saying the length or width you entered must be positive. Your program must get the length first and width the second.
Example run:
please enter length: 5
please enter width:-2
output:
The width must be positive.

another example:
please enter length: -6
please enter width:5

output:
The length must be positive.

another example:
please enter length: 5
please enter width: 4

Output:
The area is 20.

Scroll to Top