help | forum home | logged in as: guest | login/register
link mingle
interview_questions
Bookmarks
Decimal to Hexa-Decimal
5
Votes

Write a program to convert a decimal number to its hexa-decimal equivalent

saved under Amazon Interview Questions by interview_questions

 
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:09:57
 



Enter the string above
 
Thumbnails by Thumbshots.com