Guilherme Cardoso - 10 months ago 54

C# Question

I need to round numbers to 0 decimals (for a pagging system).

I've already tried something like this:

`Math.Round(double1, 0, MidpointRounding.AwayFromZero);`

If the double1 be 7,2 or 7,6 i need it to round for 8 but i'm not getting that.

Can someone help me, please?

Thanks

Answer

Use `Math.Ceiling`

to always round up to the next integer:

```
double roundUp = Math.Ceiling(double1);
```

Source (Stackoverflow)