if (num1 == 5)
{
Console.WriteLine("\nThe " + num2 + " kilo/s of {0} " + 28 + " per kilo ", "GRAPES");
Console.WriteLine("The total amount is {0}{1}", num2.ToString("en-PHI"),num2*28);
}
num2.ToString("en-PHI")
I try this one but it doesn't work at all .. it just copy the en-PHI..
Sounds like you want to provide the culture en-PHI
... although that isn't a valid culture name apparently. Perhaps you just want phi
as the language?
var culture = CultureInfo.GetCultureInfo("phi");
var text = string.Format(culture, "The total amount is {0:c}", num2 * 28);
Console.WriteLine(text);
The c
format specifier is "currency".
That's the way of printing the currency symbol known for a specific culture... now that might not do exactly what you want, but it's probably a matter of finding the right culture.
If you really just want to hard-code the peso character (U+20B1) you can do that directly:
Console.WriteLine("The total amount is \u20b1{0}", num2);
Now if that prints a "?" it means the current console encoding or font doesn't support the peso symbol. Running this from the command line will set it to UTF-8:
> chcp 65001
Make sure the font you're using supports the character as well.
See more on this question at Stackoverflow