Create a C language subroutine
char bin2hex( char N )
that returns the ASCII hex character for the four least significant bits of N.
Answer:- The code is-
#include <stdio.h>
char bin2hex(char N);
int main ()
{
char N, res;
printf ("Enter a character:");
scanf ("%c", &N);
res = bin2hex(N);
printf("\nThe ASCII hex value of least four sigificant bit is: %x", res);
return 0;
}
char bin2hex(char N)
{
return(N & 0x0F);
}
OUTPUT:-
Enter a character:b
The ASCII hex value of least four significant bit is: 2
Get Answers For Free
Most questions answered within 1 hours.