Previous Next
0 / 15
Module DEMO-33-63DEMO-OOP-33

Rectangle Area Calculator

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Write a C program that calculates the area of a rectangle. The program should read the length and width of a rectangle from standard input and output the area.

The area of a rectangle is calculated using the formula: Area = length ร— width

Example: If the length is 5.5 and the width is 3.2, the area would be 17.6.

Constraints

Both length and width will be positive floating-point numbers Both values will be less than 1000.0 No loops or conditional statements are allowed Only scanf and printf functions should be used

Input Format

Two floating-point numbers on a single line, separated by a space.

  • The first number represents the length of the rectangle
  • The second number represents the width of the rectangle

Output Format

A single floating-point number representing the area of the rectangle.

The output should be printed with exactly one decimal place.

Sample Testcases

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

Sample #1
Public sample
5.5 3.2
17.6
Length = 5.5, Width = 3.2, Area = 5.5 ร— 3.2 = 17.6

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