how to limit float to 0 decimal C# code example
Example 1: c# display float with 2 decimal places
myFloatVariable.ToString("0.00"); //2dp Number
myFloatVariable.ToString("n2"); // 2dp Number
myFloatVariable.ToString("c2"); // 2dp currency
Example 2: c# round number
double number = 1.5362
int rounded = Math.Round(number)
//rounds number to 2
double rounded_2 = Math.Round(number, 2)
//rounds number to 1.54