473,388 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Two digit after decimal

Salam

i want to display numbers with only two digit after decimal point using c#, but coud'nt success.Please any body help me.
Jun 26 '07 #1
2 6122
Lokean
71
Salam

i want to display numbers with only two digit after decimal point using c#, but coud'nt success.Please any body help me.
use the ROUND function.

Math.Round(aVariable, 2)
Jun 26 '07 #2
Or else if you are only looking for display, use ToString and format string
C# Code:
Expand|Select|Wrap|Line Numbers
  1. double d = 2314.345;
  2. string sResult = d.ToString("0.00");
  3.  
It Returns 2314.35. Note the rounding, which happens automatically.

Cheers,
Nik
Jun 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: balakrishnan.dinesh | last post by:
hi frnds, Im having two 20digit numbers, But while comparing those it is giiving wrong ouput in javascript. for example here is my code, my secanrio is , ~ If first 20 digit number is...
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
33
by: Prasad | last post by:
Hi, Can anyone please tell me how to store a 13 digit number in C language ? Also what is the format specifier to be used to access this variable ? Thanks in advance, Prasad P
7
by: Stefantastisk | last post by:
Hey there, Anyone knows a clever method for knowing the length of the digit after a decimal point in a standard C# decimal value, WITHOUT use of any string formatting. Example: 5231,12231 <-...
19
by: aa | last post by:
when I ourput data from Access, numbers bigger than 999 are shown with letter "B" inserted into the 4th position left to the coma. (in my w2k regional settings I have the decimal dot separator set...
7
by: Jay | last post by:
I want to check if a character is a decimal digit (0-9). I've found Char.IsNumber() and Char.IsDigit() but couldn't work out from Help how they differ. Also, do I need to worry about how digits...
8
by: Marc | last post by:
Hi all, I have to generate and send to a printer many 6 digit alphanumeric strings. they have to be unique but I cannot check in a database or something like that if it have already been printed....
4
by: Chris | last post by:
I tried to retrieve the digit grouping symbol in MSAccess but unfortunately 3;0 is retrieved instead of comma which is my symbol. Function retrieves decimal symbol and list separator without any...
5
by: toralf | last post by:
Hello, I'm wondering how I can test whether a field matches a 10-digit integer within DB2. -- MfG/Sincerely Toralf Förster pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6...
2
by: Jcan | last post by:
HI I have a 10 digit ASCII array: char Arr = {'1','2','3','4','5','6','7','8','9','1'} I have to convert the the array to decimal. I do this by subtracting 0x30 and multiplying with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.