I need to create a C# program that does the following:
Converts a character such as 'S' to 0x53 or 83 decimal and I need to print it on the screen as
char hex decimal
S 53 83
can anyone help.
thanks,
barry
Conversions from ASCII to hex to decimal, all 3
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted Mar 20, 2007, 3:35 PM EDT
using System; using System.Collections.Generic; using System.Text; namespace testhex { class Program { static void Main(string[] args) { char c = 'S'; Console.WriteLine("{0} {1} {2}", c, ((int) c).ToString("x"), ((int) c).ToString()); Console.ReadLine(); } } }