subject

Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type unsigned char. Read two int values p and k from the keyboard, where the values are less than 8. Replace the n bits of the first variable starting at position p with the last n bits of the second variable. The rest of the bits of the first variable remain unchanged. Display the resulting value of the first variable using printf %x. Test Cases:n = 3;p=4;input: a= 0x1f (0001 1111) b = c3 (1100 0011); output: f (0000 1111)n = 2;p=5;input: a= 0x1f (0001 1111) b = c3 (1100 0011); output: 3f (0011 1111)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
Write a program that reads the file, then displays the average number of steps taken for each month. (the data is from a year that was not a leap year, so february has 28 days.) your program needs to use at least 3 functions not counting main and display the information in a neat well formatted fashion.
Answers: 3
question
Computers and Technology, 22.06.2019 08:40
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
This is not a factor that you should use to determine the content of your presentation. your audience your goals your purpose your technology
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
You know the right answer?
Write a C program that reads two hexadecimal values from the keyboard and then stores the two values...
Questions
question
Mathematics, 31.03.2020 02:42
question
Mathematics, 31.03.2020 02:42
question
Biology, 31.03.2020 02:42
question
History, 31.03.2020 02:42
question
Biology, 31.03.2020 02:42