//************************************** // Name: String.Format // Description:use String.format to format the output // By: hatem mostafa ahmed // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** public class Program { public static void Main() { int Invoice =81; Console.WriteLine(String.Format("{0:0000}",Invoice)); int[] invoiceNum={3,55,99,44,174,12}; foreach(int i in invoiceNum) Console.WriteLine(String.Format("{0:00000}",i)); int price=830; Console.WriteLine(String.Format("{0:c}",price)); int salary =7000; Console.WriteLine(String.Format("{0:f}",salary)); DateTime td =Convert.ToDateTime("1/1/2000 12:00 pm"); String myDate=String.Format("{0:MMMM-yyyy}",td); Console.WriteLine(myDate); } }