How to round up in c#

Scott picture Scott · Apr 10, 2011 · Viewed 87.7k times · Source

I want to round up always in c#, so for example, from 6.88 to 7, from 1.02 to 2, etc.

How can I do that?

Answer

BrokenGlass picture BrokenGlass · Apr 10, 2011

Use Math.Ceiling()

double result = Math.Ceiling(1.02);