-1

how to round up number upper or lower in the simplest way? for example

36 >>> 40

33 >>> 30

away10
  • 1
  • 3
    does this answer your question? https://stackoverflow.com/questions/274439/built-in-net-algorithm-to-round-value-to-the-nearest-10-interval – l3est Dec 08 '20 at 17:06

1 Answers1

1

Check out the documentation for System.Math.Round. You can specify whether you want to round up/down as well as the interval you want to round to.

Fydar
  • 374
  • 4
  • 8
  • 1
    And how would one call `System.Math.Round` to round the integral value `36` to `40`? –  Dec 08 '20 at 17:15
  • 1
    Thank you for taking the time to share your knowledge & experience. But your answer has a low quality. Sometimes a comment or a flag/close may be more relevant. To help you improve your answers, please read the [How do I write a good answer](https://stackoverflow.com/help/how-to-answer), [How do I write a good answer to a question](https://meta.stackexchange.com/questions/7656/how-do-i-write-a-good-answer-to-a-question) & [Answering technical questions helpfully](https://codeblog.jonskeet.uk/2009/02/17/answering-technical-questions-helpfully). –  Dec 08 '20 at 17:22
  • 1
    Round is for decimal part, as I know and as I quickly checked in the documentation, isn't it ? –  Dec 08 '20 at 17:22