Wrong :
double Sal = 1250.45; Console.WriteLine("Salary before hike is {0:D}", Sal); //Decimal instead of double Console.WriteLine("Salary before hike is {F}", Sal); //Index is missing
Correct:
double Sal = 1250.45; Console.WriteLine("Salary before hike is {0:F}", Sal);
USe appropriate composite format string - decimal , double
No comments:
Post a Comment