Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace StringFormat
- {
- class StringFormat
- {
- static void Main()
- {
- int num = 123;
- Console.WriteLine(num.ToString("D6"));
- //in Hexadecimal:
- Console.WriteLine(num.ToString("X"));
- //Convert to char
- Console.WriteLine(Convert.ToChar(num));
- //Convert to string
- Console.WriteLine(Convert.ToString(num));
- Console.WriteLine("{0:C}",num);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment