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

Surface Area of a Cone

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Calculate the total surface area of a cone given radius r and height h.

Formula: PI * r * (r + sqrt(h^2 + r^2)).

Target difficulty: Medium

Constraints

r, h > 0

Input Format

Two numbers: r and h.

Output Format

Surface 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
3.0 4.0
75.40
PI * 3.0 * (3.0 + sqrt(4.0^2 + 3.0^2)) = 75.40
Sample #2
Public sample
5.0 12.0
282.74
PI * 5.0 * (5.0 + sqrt(12.0^2 + 5.0^2)) = 282.74
Sample #3
Public sample
2.0 5.0
46.40
PI * 2.0 * (2.0 + sqrt(5.0^2 + 2.0^2)) = 46.40
Sample #4
Public sample
0.5 1.0
2.54
PI * 0.5 * (0.5 + sqrt(1.0^2 + 0.5^2)) = 2.54

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