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

Floor Function

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that rounds a number down to the nearest integer using floor.

Target difficulty: Easy

Constraints

None

Input Format

A single floating-point number.

Output Format

The floor value formatted to 0 decimal places (integer).

Sample Testcases

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

Sample #1
Public sample
2.3
2
floor(2.3) = 2.00
Sample #2
Public sample
-2.3
-3
floor(-2.3) = -3.00
Sample #3
Public sample
5.0
5
floor(5.0) = 5.00
Sample #4
Public sample
-0.1
-1
floor(-0.1) = -1.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