3. Area and Perimeter of a Rectangle
Foundation1000 ms256 MBSolved by 100%
Read the length and width of a rectangle from one line and print its area and its perimeter, separated by a single space, on one line.
Area is length × width. Perimeter is 2 × (length + width).
Constraints - `1 ≤ length, width ≤ 100000`
Input
A single line containing two integers, separated by a space.
Output
Print two integers on one line, separated by a single space, the area, then the perimeter.
Input5 3
Output15 16
Noteis a simple rectangle
Input10 10
Output100 40
Noteis a square, where length and width are equal
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.