Updated on Kisan Patel
To round any number to its nearest whole number, you need to use static Math.Round
method as shown in below code snippet:
int x = (int)Math.Round(2.5555); // x == 3
To round a floating-point value to a specific number of decimal places:
double y = Math.Round(2.5555, 2); // x == 2.56