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

  Writing a program as part of the bakov distribution center

In this assignment assume you are writing a program as part of the 'Bakov' distribution center which is in turn part of Elon's this vast business empire

  Write a program that prompts the lowest temperature

Write a program that prompts the user for the lowest and highest Fahrenheit temperature wanted in the table, and also prompts the user for the desired step size between rows of the table.

  Calculate the effective access time

Calculate the Effective Access time if page fault rate is 5% and 60% of time the page has to be replaced.

  Implement menu-driven program for managing a software store

Write a C++ program to implement a menu-driven program for managing a software store using binary search trees.

  Write a c program to search a list of integers

Write a C program to search a list of integers for a particular value. The user should be prompted to enter the value to be searched for. Your program will then print out whether the value was found or not.

  Write a program that allows the user to enter a tax bracket

How much higher the interest rate must be depends on the investor's tax bracket. Write a program that allows the user to enter a tax bracket .

  Program a microprocessor

You need to program a microprocessor that would have a temperature, gas, humidity and PIR sensor connected to it.

  Write code that declares an int array named month

Write code that declares an int array named month with 5 rows and 7 coloumns and initializes every element to -1.

  Loops and nested loops

Loops and Nested Loops- Suggest one (1) example of a problematic programming situation or scenario that nested loops could at least partially resolve. Justify your response

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the

  Program to convert number to words

Write a program that stores and converts a number entered in Roman numerals to an integer value. Your program must consist of a class named Roman.

  Prepare a program that uses at least two functions that can

prepare a program that uses at least two functions that can be called from your main. this program is a number game

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