Quantcast
Channel: Formatting C# output - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by btk for Formatting C# output

Take a look at this page, esp. the "Custom number formatting" section. To show a number as two digits only you'd do something like this: int x = 2; string output = string.Format("{0:00}", x);...

View Article



Answer by Pratik Deoghare for Formatting C# output

for example for (int i = 0; i < 100; i++) { Console.WriteLine("{0:00}", i); }

View Article

Answer by user156862 for Formatting C# output

Take a look at http://msdn.microsoft.com/en-us/library/0c899ak8.aspx This should do what you want: int num = 10; Console.WriteLine(num.ToString("0#")); Console.ReadLine(); The string that is passed to...

View Article

Formatting C# output

I am trying to format some c# output so that a number always has 2 digits for instance if int = 0 i would like Console.WriteLine(int); to produce 00.

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images