---
title: "Round double type variable to two decimal places in C#."  
description: "Round double type variable to two decimal places in C#."  
author: "Anupam Mishra"  
published: 2016-01-15  
updated: 2016-01-15  
canonical: https://www.mindstick.com/forum/33881/round-double-type-variable-to-two-decimal-places-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# Round double type variable to two decimal places in C#.

Hi all,\
\
I m rounding [values](https://www.mindstick.com/forum/327/sum-textbox-values) using below [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):\

> double _total =100.0056;\

its displaying as 100.0056 [instead of](https://www.mindstick.com/articles/330/triggers-in-sql-server) 100.01 i m [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to [round](https://answers.mindstick.com/qa/45311/what-was-the-agenda-of-the-round-table-conference-1930-1932) up for 2 [decimal](https://www.mindstick.com/forum/34709/please-write-a-program-for-decimal-to-binary-conversion-in-c-sharp) places but its not working.. same [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) occurs when i use [Datatype](https://www.mindstick.com/forum/160266/explain-the-datatype-data-annotation-and-its-significance-in-data-entry-and-display) as Decimal.. how can i round up exactly.\
\
thank you.\
\

## Replies

### Reply by Manoj Bhatt

If you use **Math.Round(double _total, NoOfPrecision)** in your code then you get correct output upto no's of precision.For consider, your code is as follows:\

```
   double _total =Math.Round(Convert.ToDouble(100.0056), 2);        Console.WriteLine(_total);
```

## Output:

## 100.01

Similarily, for other datatype , you need to conversion in Round() function to passed as parameter.


---

Original Source: https://www.mindstick.com/forum/33881/round-double-type-variable-to-two-decimal-places-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
