Write a c program which will flip a single bit in a number

Assignment Help C/C++ Programming
Reference no: EM132194779

Question: Write a C program which will flip 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 using a scanf. Output is to the screen.

For this assignment give the user directions asking them to enter the integer and then ask them which bit to flip. That can be a number between 0 and 31. After completing the operation ask the user if they want to do it again. You do not need to use getopt for this program.

If the user enters a 1 as the initial value and a 0 for the bit to switch the result would be 0. If the user enters a 10 as the initial value and a 1 for the bit to switch then the result would be 8. . If the user enters a 10 as the initial value and a 2 for the bit to switch then the result would be 14.

The program should compile to create an executable called bitswitch. Submit your c file and your Makefile.

Reference no: EM132194779

Questions Cloud

Ask the user for the value of four resistors in your series : The "main" section of the program will ask the user for the value of four resistors in your series circuit and the total voltage (V) applied to the series.
Write c program that helps a professor to manage records : Write C program that helps a Professor to manage student records. Each student's record contains information like Student ID.
Write a c program that finds the nth prime number : Write a C program that finds the nth prime number and prints it on the screen. A prime number is a number that is only divisible by 1 and by itself.
A program to help the administration of a football league : Write a C++ program to help the Administration of a football league to manipulate the list of players registered in different teams.
Write a c program which will flip a single bit in a number : Write a C program which will flip a single bit in a number entered by the user using the binary representation of the number. The user should input the original
A program that initializes an array with ten random integers : Write a C++ program that initializes an array with ten random integers and then prints all elements in two lines of output containing.
Write a program that creates a vector of given elements : Write a C++ program that creates a vector of 15 integer elements. Using an iterator, assign each element a value that is three times of its current value.
Write a c program that contains a structure : Write a C program that contains a structure that uses predefined types and union. Create a struct with name, age, kind (Either child, college student, or adult)
A c program that will check the current setting of echo : Write a C program that will check the current setting of "echo". It it is on, display the message and turn it off.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  What is special about the point where cp is a maximum

what position along the chord does the minimum pressure occur - what is special about the point where Cp is a maximum?

  Define the term root-to-leaf path in detail

My goal, given a binary tree and a sum, is to return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Returning false if no such path can be found.

  Program to compute the total volume

Write a program to compute the total volume for a number of cylinders. A cylinder may have different values for height and radius.

  Write a program that will read in 2 test score.

Write a program that will read in 2 test score. The instructor has decided to give each student 10 bonus point on each test. Print out each test score and the total after the bonus, the print the total number of points earned on the tests.

  Write an program simulation to do the three common task

Each user information is stored in an array. The WETHDRAW function to make money withdrawal. The DEPOSIT function to deposit money in the account.

  Find the average of four 16-bit unsigned integers

Write a program (starting at address $4000) to find the average of four 16-bit unsigned integers stored at locations $5000, $5002, $5004 and $5006 and store the 16-bit result at location $5010.

  Object-oriented programming with vcl form

I need someone to help in my project which is windows application program. It supposed to be in program Object-Oriented Programming in C++ with VCL form.

  What is the expected cost of the search

You are trying to locate a stolen car using a helicopter. The helicopter costs $350 per hour to rent. The number of hours to find the car follows a discrete uniform random variable with a = 3 and b =11. What is the expected cost of the search?

  Write pseudocode for a program

Write pseudocode for a program that prompts the user for a month and day and prints out whether it is one of the following four holidays.

  Define abstraction programming language

C++ is another computer programming language. In addition, C is foundation for C++ as well. Bjarne Stroustrup developed C++. This was in 1980's.

  Find the factorial of a given integer

Write C programs that use both recursive and non-recursive functions. i) To find the factorial of a given integer.

  Execute a program that requires sequential files

Build, and execute a program that requires sequential files to make address database - Demonstrate entering, appending, storing, and retrieving records

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd