Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to round numbers down

+6 votes
asked Nov 13, 2025 by Ty Twarling (180 points)

3 Answers

0 votes
answered Nov 19, 2025 by Sawyer (340 points)
I’m pretty new to programming but I’m pretty sure you could just remove the decimal and everything after it (Idon’t know how to do that) or if there is a round up script then simply subtract one then round up.
0 votes
answered Nov 20, 2025 by Peter Minarik (101,340 points)

There are various ways to approach this. I'm going to use C as the language (as you did not specify the target language).

  1. If you're looking for a floating-point number for your result, you can use floor() to remove the decimal digits.
  2. If you're looking for an integral number for your result, you can simply just cast your floating-point number to an integral number: int three = (int)3.14;

Most languages have similar functionalities.

+1 vote
answered Nov 22, 2025 by Tarun Sivakumar Reddy (160 points)

To round numbers down, you choose the nearest integer (or specified place value) that is less than or equal to the number.


import math 

print(math.floor(3.9)) # 3

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...