In this recipe, we will learn how to convert a binary number into a hexadecimal number. A binary number comprises two bits, 0 and 1. To convert a binary number into a hexadecimal number, we first need to convert the binary number into a decimal number and then convert the resulting decimal number to hexadecimal.
Converting a binary number into a hexadecimal number
How to do it…
- Enter a binary number and assign it to the b variable:
printf("Enter a number in binary number ");
scanf("%d",&b);
- Invoke the intodecimal function to convert the binary number into a decimal number, and pass the b variable to it as an argument. Assign the decimal number...