Hi Guys
NP137 |{2:X}|
In this program output is giving 3D326. Please explain the reason.
Thank you
using System;
public class MainClass
{
public static void Main()
{
int i = 250662;
string s = string.Format("|{0,10:X}|{1,10}|{2:X}|{3}|", i, i, i, i);
Console.WriteLine(s);
}
}
//| 3D326| 250662|3D326|250662|
Posted Aug 26, 2008, 3:44 PM
Thank you very much for explanation.
AlanPosted Aug 26, 2008, 11:11 AM
3D326 in hexadecimal ('X' format specifier) is equivalent to the following decimal number:
(3 x 16 ^ 4) + (13 x 16 ^ 3) + (3 x 16 ^ 2) + (2 x 16) + 6 = 250,662
where (16 ^ p) denotes raising 16 to the power 'p'.