Challenge: Rectangle Calculator

Lab C Beginner 10 points

Read the width and height of a rectangle (two whole numbers) and print its area and perimeter.

Input

Two integers on one line: width and height.

Output

Two lines: Area: A and Perimeter: P.

Example

Input

4 3

Output

Area: 12
Perimeter: 14
Sample input available Sample output available
Editor
C

Hints

Read both numbers with one scanf("%d %d", ...).

Perimeter is 2 * (width + height).

Solution explanation

Area multiplies the sides; the perimeter adds all four sides, which is twice width plus height.

Show solution
#include <stdio.h>

int main() {
    int width, height;
    scanf("%d %d", &width, &height);
    printf("Area: %d\n", width * height);
    printf("Perimeter: %d\n", 2 * (width + height));
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD