Previous Next
0 / 20
Module DEMO-32-89DEMO-C-32

Area of a Circle

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that calculates the area of a circle given its radius r.

Use the formula: Area = PI * pow(r, 2). Use 3.14159 for PI.

Target difficulty: Easy

Constraints

r >= 0

Input Format

A single floating-point number r.

Output Format

The area formatted to 2 decimal places.

Sample Testcases

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

Sample #1
Public sample
1.0
3.14
PI * 1.0^2 = 3.14159 * 1.0 = 3.14
Sample #2
Public sample
5.0
78.54
PI * 5.0^2 = 3.14159 * 25.0 = 78.54
Sample #3
Public sample
0.0
0.00
PI * 0.0^2 = 3.14159 * 0.0 = 0.00
Sample #4
Public sample
100.0
31415.90
PI * 100.0^2 = 3.14159 * 10000.0 = 31415.90

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