Convert integer to decimal ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?dHZpbg==?=

    #1

    Convert integer to decimal ?

    Hello everyone,

    Please can someone help me, i want to convert int number to decimal
    but as this way:
    00000005465 to 54.65
    Note: i don't want 5465.00

    so is there any code can do this or should i have to write special code.

    Thanks for your help.
  • Jon Skeet [C# MVP]

    #2
    Re: Convert integer to decimal ?

    On Nov 15, 1:17 pm, tvin <t...@discussio ns.microsoft.co mwrote:
    Hello everyone,
    >
    Please can someone help me, i want to convert int number to decimal
    but as this way:
    00000005465 to 54.65
    Note: i don't want 5465.00
    >
    so is there any code can do this or should i have to write special code.
    Well, what are the specific requirements here? How should it know how
    many decimal places to use? Is it always 2 decimal places? If so, just
    use:

    int i = 5465;
    decimal d = ((decimal)i)/100;

    Jon

    Comment

    Working...