|
interview_questions
|
|
|
|
|
Bookmarks
|
|
|
|
|
|
|
Convert Decimal to Hexadecimal
|
| |
char hex[20] = {'\0'};
int i = 0;
while(num)
{
int x = num % 16;
if(x>=0 && x<=9)
{
hex[i++] = '0' + x;
}
else
{
hex[i++] = 'A' + (x % 10);
}
}
hex[i] = '\0';
strrev(hex);
comment by sachidanand on 2009-09-29 10:08:49
|
temp="";
while(n>0){
temp=array[n&15] + temp;
n = n>>4;
}
where array is a sequence of characters from 0 to F.
comment by aravinds03 on 2010-09-25 16:11:24
|
|
|