I already understand how to convert it into it's numerical value, but i dont understand how to display the result into it's alphabetical value.
like the hexadecimal value of 26 = 1A.
i'm stuck at displaying the value as 26 = 110.
this is how i do so far :
can someone please point out my mistake ?
Code:
#include <stdio.h>
int main ()
{
int ask = 26;
int a;
int b[9];
int c = 0;
while ( ask > 0 ) {
a = ask % 16;
if ( a == 10 ) {
b[c] = 'A';
}
if ( a == 11 ) {
b[c] = 'B';
}
if ( a == 12 ) {
b[c] = 'C';
}
if ( a == 13 ) {
b[c] ='D';
}
if ( a == 14 ) {
b[c] = 'E';
}
if ( a == 15 ) {
b[c] = 'F';
}
else {
b[c] = a;
}
c++;
ask = ask / 16;
}
while ( c ){
printf ("%d", b[--c]);
}
getchar ();
return 0;
}