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

Square Root Calculation

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that reads a floating-point number x and prints its square root using the sqrt function from math.h.

Ensure you include <math.h>.

Target difficulty: Easy

Constraints

x >= 0

Input Format

A single non-negative floating-point number.

Output Format

The square root 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
4.0
2.00
sqrt(4.0) = 2.00
Sample #2
Public sample
2.0
1.41
sqrt(2.0) = 1.41
Sample #3
Public sample
0.0
0.00
sqrt(0.0) = 0.00
Sample #4
Public sample
9.0
3.00
sqrt(9.0) = 3.00

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