Good Evening to all..
Can someone help with regards to converting decimal to hexadecimal?
I'm using stack.
I am done. in doing Dec to binary and Decimal to Octal.
My problem is how to convert decimal to hex? specially if its include now with letters A to D..
pls i really need ur answers or suggestions.. here is my code for converting dec to hex.
System.out.print("Enter a Decimal Value:");
num=console.nextInt();
q=num;
while(true)
{
s.push(q%16);
q=q/16;
if(q==0)
break;
}
System.out.print("HexaDecimal equivalent");
while(!s.isEmpty())
{
System.out.print(s.pop());
}
my problem is that.. how about if the pop value is 10? basically it should be converted into letter A. but how to do that? pls me... i really need to finish my program.. :(