Skip to content

Decimal number

maffle

Asked Dec 10, 2006, 6:36 PM EST3 answers
Share
LinkedInX
i want to get only the whole part of a decimal number.
how to do it in C#?
sample: 2.14=2
           2.54=2

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    mybe im not using int the right way. instead i used Math.Truncate! tnx 4 ur help! mybe i can use that some other tym. tnx again
    0
  • 0
    Math.Floor(2.54)

    will return 2
    0
  • 1 short reply
    • 0
      Just use (int)YourDecimal;
      0