D
D
d1msk1y2021-11-25 18:32:28
C++ / C#
d1msk1y, 2021-11-25 18:32:28

How to round a number in C#?

I'm sure you immediately thought of Mathf.Round() , but it won't help here. I need to round for example: from 625 round to 620 , that is, round units, or even immediately round tens, that is, from 625 to 600. Any options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2021-11-25
@d1msk1y

Round tens 625/10=62.5 round by round, then multiply by 10 = 620
Round hundredths 625/100=6.25 round by round, then multiply by 100 = 600
etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question