subject

Bitwise operations in c. write a c program which will either set or clear a single bit in a number entered by the user using the binary representation of the number. the user should input the original integer value between 1 and 1000 inclusive using a scanf. use an unsigned integer type. output is to the screen. you must use only bitwise operators for this program. you can shift bits and or use the logical bitwise operators. for this assignment give the user directions asking them to enter the integer and then ask the user if he or she wants to clear or set a bit. then ask the user which bit to set or clear. that can be a number between 0 and 31. prompt the user for what should be entered each time. be sure to validate all user input so the program cannot be crashed. after completing the operation ask the user if they want to do the entire operation again. the user would enter y or y to do it again. this would be the entire operation from entering the first integer.•if the user enters a 1 as the initial value and a 0 for the bit to clear the result would be 0.•if the user enters a 1 as the initial value and a 0 for the bit to set the result would be 1.•if the user enters a 10as the initial value and a 1 for the bit to clear then the result would be 8.•if the user enters a 10 as the initial value and a 1 for the bit to set then the result would be 10.•if the user enters a 10 as the initial value and a 2for the bit to clear then the result would be 10.•if the user enters a 10 as the initial value and a 2 for the bit to set then the result would be 14.output for each operation should be easy to read giving the number before the switch and then the decimal number after the switch. no other output should be included.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:30, edgytaehyung
Someone wishes to run the software on another computer system that runs an operating system that does not support the software what can he do
Answers: 3
image
Computers and Technology, 22.06.2019 21:40, tdahna0403
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
image
Computers and Technology, 23.06.2019 01:00, Ltik11900
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
image
Computers and Technology, 23.06.2019 08:00, ionmjnm3041
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
You know the right answer?
Bitwise operations in c. write a c program which will either set or clear a single bit in a number e...

Questions in other subjects:

Konu
Mathematics, 06.10.2020 14:01
Konu
Arts, 06.10.2020 14:01