Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I have a variable in the cs page with the type Float,
and this variable values are displey 99.3333
and i want to 99.33 so give me some idea about this how to convert it
Thanks
Posted

You can use
C#
Math.Round(99.3333, 2)
function.
 
Share this answer
 
Try this
C#
float d = (float)99.3333;
Console.WriteLine(d.ToString("0.##"));


Hope this helps
 
Share this answer
 
v2
C#
decimal b = 1.995555M;

Math.Round(b, 2); //returns 2.00
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900