Previous Next
0 / 11
Module DEMO-33-62DEMO-OOP-33

Rectangle Metrics

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read rectangle width and height, then print its area and perimeter.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. width
  2. height

Output Format

Print the exact report in this order:

  1. Area
  2. Perimeter

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3
4
Area: 12
Perimeter: 14
Input: width = 3, height = 4.
Key calculation(s): area = 3 * 4 | perimeter = 2 * (3 + 4) | "Area: " + area = "Area: 12".
Output:
Area: 12
Perimeter: 14
Sample #2
Public sample
7
2
Area: 14
Perimeter: 18
Input: width = 7, height = 2.
Key calculation(s): area = 7 * 2 | perimeter = 2 * (7 + 2) | "Area: " + area = "Area: 14".
Output:
Area: 14
Perimeter: 18

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings