Format the same argument three different ways : Console Output « Development « C# / CSharp Tutorial






using System;   
   
class MainClass {   
  public static void Main() {   
 

    Console.WriteLine("{0:F2}  {0:F3}  {0:e}", 10.12345);   
   
  }   
}
10.12  10.123  1.012345e+001








14.3.Console Output
14.3.1.Console I/O
14.3.2.WriteLine
14.3.3.Write without new line
14.3.4.Substituting Values
14.3.5.Substituting Values twice
14.3.6.Write to Console.Out and Console.Error
14.3.7.Output an int to console
14.3.8.Concatenate string in Console.WriteLine
14.3.9.Format the same argument three different ways
14.3.10.Display arguments in non-sequential order
14.3.11.Variable index
14.3.12.Variable index: reference a variable more than once
14.3.13.Escape Characters: \\
14.3.14.Adds a total of 4 blank lines (then beep again!)
14.3.15.Displaying a Triangle Using a Verbatim String Literal
14.3.16.Use OpenStandardOutput method.