#C14244. Calculate Perimeter and Area of a Rectangle
Calculate Perimeter and Area of a Rectangle
Calculate Perimeter and Area of a Rectangle
This problem requires you to compute the perimeter and area of a rectangle given its length and width. You are provided with two non-negative integers representing the dimensions of the rectangle.
The formulas you will use are given in LaTeX as follows:
- Perimeter: \(P = 2 \times (length + width)\)
- Area: \(A = length \times width\)
Your task is to read the rectangle's length and width from standard input (stdin), calculate the perimeter and area, and then print both values to standard output (stdout) in a single line separated by a space.
inputFormat
The input consists of a single line containing two non-negative integers separated by a space. The first integer represents the length and the second represents the width of the rectangle.
For example:
4 7
outputFormat
Output two integers in one line separated by a space. The first integer is the perimeter and the second is the area of the rectangle.
For example:
22 28## sample
4 7
22 28
</p>