Question

Create a C language subroutine char bin2hex( char N ) that returns the ASCII hex character...

Create a C language subroutine

char bin2hex( char N )

that returns the ASCII hex character for the four least significant bits of N.

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use C language    bool isupper(char c): This function returns true if the character in c is...
Use C language    bool isupper(char c): This function returns true if the character in c is an uppercase character between A and Z (inclusive). Note that the C standard library function isupper() both accepts and returns an int, not char or bool, but the behavior is equivalent.     void strlower(char str[]): Change all uppercase ASCII characters in the C string str to their lowercase equivalents. For example, A would become a, and G would become g. All other characters in...
In Assembly language for MSP430: Create a subrutine called ‘numadd’ that add every numeric character present...
In Assembly language for MSP430: Create a subrutine called ‘numadd’ that add every numeric character present in a phrase (“string” that follows the convention of the C language). For Example, If the phrase says: “Today is the day 15 of quarantine of the month 8”, the subroutine needs to do the following sum: 1+5+8 = 14. The subroutine needs to receive the direction of the first character of the phrase corresponding in the “stack” and return the result in the...
Use C language fist one to check if is lowercase,and second one to conver it to...
Use C language fist one to check if is lowercase,and second one to conver it to uppercase. Use ASCII table. boolean islowcase(char n) void strupper(char c)
Write a function to create a copy of a string with the prototype below. (C Language)...
Write a function to create a copy of a string with the prototype below. (C Language) char * strcpy (const char *); The function should dynamically allocate the necessary memory for the new string. You can do that with char * newstr = (char *) malloc(sizeof(char) * (strlen(str)+1)); assuming str is your input string. Think though how you would copy the characters of the string, and don't forget about the end of string character.
Write ARMv8 Assembly code and C++ code for a function called int grade(int n) that returns...
Write ARMv8 Assembly code and C++ code for a function called int grade(int n) that returns the character 'A' if n >= 90, 'B' if 90 > n >= 80, etc. (Use the ASCII code.)
FOR C PROGRAMMING LANGUAGE Write a recursive C PROGRAMMING LANGUAGE function int sumStrlens(const char* str1, const...
FOR C PROGRAMMING LANGUAGE Write a recursive C PROGRAMMING LANGUAGE function int sumStrlens(const char* str1, const char* str2) which returns the sum of strlen(str1) and strlen(str2). You can assume that strlen(str2) is always strictly greater than strlen(str1) (strlen(str2) > strlen(str1)). You MAY NOT use any function from string.h. You MAY NOT use any square brackets([]) or any type of loops in function.
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n");...
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n"); for (i = 32; i < 256; i++){ printf("%2x %3d %3o %c\n",i,i,i,i); } return 0; } the code below shows where to do the assembly at: int main(){ int i = 0; char *hdr = "Hex Dec Oct Ch\n"; char *msg = " %2x %3d %3o %c\n"; printf("%s\n",hdr); ———asm{ // DO ASSEMBLY HERE } system("pause"); }
Programming in C language (not C++) Write a main function with a function call to a...
Programming in C language (not C++) Write a main function with a function call to a function called Calculation which has two integer arguments/ parameters. The function returns a character. Declare and initialize the necessary data variables and assign balues needed to make it executable and to prevent loss of information. //input 2 integer values //returns the characterequivalent of the higher of the two integer values char Calculation(int, int);
I am to create three different versions of the following C program code below that implements...
I am to create three different versions of the following C program code below that implements the conversion of unsigned binary numbers into decimal (Base 2 to Base 10 conversion). Version 1: Complete the C program ”bin2dec ver1.c” that implements binary to decimal conversion. The maximum number of binary bits is 32. The program is made of the functions ”unsigned binary to decimal(const char *str)”and ”main”. The parameter ”str” passed to this function points to a C string comprising only...
In Python language: Create a function that takes as input two numbers, m and n, m<n,...
In Python language: Create a function that takes as input two numbers, m and n, m<n, and returns an m×n list-of-list-of-numbers. Each element of the outer list will be a list of consecutive integers, beginning with 1 and ending with n−1. If you're feeling bold, try to use list comprehension.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT