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

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
How are natural numbers, whole numbers, integers, and rational numbers related
Answers: 3
question
Computers and Technology, 22.06.2019 14:20
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
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
question
Mathematics, 22.04.2021 05:50
question
Biology, 22.04.2021 05:50
question
Mathematics, 22.04.2021 05:50
question
Biology, 22.04.2021 05:50
question
Chemistry, 22.04.2021 05:50
question
English, 22.04.2021 05:50
Questions on the website: 13722363