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

Base-10 Logarithm

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that calculates the base-10 logarithm of a number using log10.

Target difficulty: Easy

Constraints

x > 0

Input Format

A single positive floating-point number.

Output Format

The base-10 logarithm 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
10.0
1.00
log10(10.0) = 1.00
Sample #2
Public sample
1.0
0.00
log10(1.0) = 0.00
Sample #3
Public sample
0.1
-1.00
log10(0.1) = -1.00
Sample #4
Public sample
2.0
0.30
log10(2.0) = 0.30

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