Round off in ASP.NET

RoundOff the Values in ASP.NET C# , if you want rounded value so you use the C# function (Round)

Round Double Values

//if you have a double variable
// double num = 12.23456;
// but you want to 12.23

//then you use a c# math function

double num = 12.23456;
Response.Write(Math.Round(num, 2));

//you will get 12.23

//if you have 12.23546
//and you want 12.24

double num = 12.23546;
Response.Write(Math.Round(num, 2));

//you will get 12.24

Related Articles

More articles: Rounding Off Decimals Round Off Rounding Math Round


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: