Computer Science, asked by aditioraon637, 4 months ago

write C programming to convert a 4 digit binary no to its hexadecimal no.​

Answers

Answered by tanushpradhan82
0

Answer:

* C Program to Convert Binary to Hexadecimal.

long int binaryval, hexadecimalval = 0, i = 1, remainder;

printf("Enter the binary number: ");

scanf("%ld", &binaryval);

while (binaryval != 0)

remainder = binaryval % 10;

hexadecimalval = hexadecimalval + remainder * i;

i = i * 2;

Answered by srishtisoumya03082
0

1. Take a binary number as input.

2. Divide the binary number into groups of 4 bits. For each group of 4 bits, multiply each bit with the power of 2 and add them consecutively.

3. Combine the result of all groups to get the output.

Similar questions