Friday, March 26, 2010

Changing base of a number

Suppose we want to convert 0xFACE into decimal value.


echo "ibase=16; obase=A; FACE" | bc


'ibase' is input number base.
'obase' is output number base in ibase number.(10 is A in hexadecimal format).
'FACE' is the number.

when we dont specify any of the value, its assumed to be 10.

No comments:

Post a Comment