Extract integral part of a decimal number in C#?

Forum Home Forums Understanding the Software Using Formulas Extract integral part of a decimal number in C#?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6914
    HoracioHoracio
    Participant

    The title explains my question.
    How to do it in C#?
    Thank you very much.

    #6915
    MikhailMikhail
    Moderator

    You can use the Math class:

    Math.Ceiling(Cnl)
    Math.Floor(Cnl)

    or just
    (int)Cnl

    #6916
    HoracioHoracio
    Participant

    Hello!

    (int)Cnl worked fine.
    By the way, I found a “C# Online Compiler” on dotnetfiddle.net
    that allows to evaluate and test C# expressions. Easy and very helpful.

    Thank you very much. Regards

    #6919
    MikhailMikhail
    Moderator

    By the way, I found a “C# Online Compiler” on dotnetfiddle.net

    Good idea!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.