Simply,
class Program
{
static void Main( string [ ] args )
{
int i = 010;
Console.WriteLine( i );
Console.ReadKey( );
}
}
Output:
10
How to stop trimming leading zeros ?
Decimals have same output, strings aren’t best solution too.
You need to store it in a string. Then you can cast it back to integer when you need calculations, then cast it back to string when you’re done using the desired format.