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

Volume of a Cylinder

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Calculate the volume of a cylinder given radius r and height h.

Formula: PI * pow(r, 2) * h.

Target difficulty: Medium

Constraints

r, h > 0

Input Format

Two numbers: r and h.

Output Format

Volume 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 1.0
3.14
PI * 1.0^2 * 1.0 = 3.14
Sample #2
Public sample
5.0 10.0
785.40
PI * 5.0^2 * 10.0 = 785.40
Sample #3
Public sample
10.0 1.0
314.16
PI * 10.0^2 * 1.0 = 314.16
Sample #4
Public sample
1.0 10.0
31.42
PI * 1.0^2 * 10.0 = 31.42

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