In the familiar base 10 system

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

The Binary Number System

In the familiar base 10 system, the smallest (rightmost) digit of a number is the ones place (100).  The next digit is in the tens place (101), and the next one is in the hundreds place (102) and so forth.  Thus the number 122 is really (1 * 102) + (2 * 101) + (2 * 100).  Each digit is worth a power of 10 more than the digit to the right of it in the base 10 system.

Similarly, in the binary number system, the smallest (rightmost) digit of a number is the ones place (20).  The next digit is in the twos place (21), and the next one is in the fours place (22) and so forth.  Thus the number 101 is really (1 * 22) + (0* 21) + (1 * 20) = 5.  Each digit is worth a power of 2 more than the digit to the right of it in the base 2 system.

Write a program to display all of the binary digits of a number.  You program should continue

to display binary digits of numbers until the user wishes to stop.

Hint:

To find a binary digit, print the remainder number % 2, then replace the number with number/2.  Repeat this process until the number is 0.

SAMPLE OUTPUT:

Enter a number for binary conversion=>13
Binary Number
1
0
1
1

Another number to enter =? , type 1 for yes and any other number for no=>1
Enter a number for binary conversion=>10
Binary Number
0
1
0
1
Another number to enter =? , type 1 for yes and any other number for no=>2

Reference no: EM13843415

Questions Cloud

Use h2c4h4o4 to determine the concentration of naoh : Use H2C4H4O4 to determine the concentration of NaOH, Which solution will you put in the buret and which solution will you titrate?
Diagram represents the collection of co2 and h2o molecules : The question is: The following diagram represents the collection of CO2 and H2O molecules formed by complete combustion of a hydrocarbon.  What is the empirical formula of the hydrocarbon?How do I find the empirical formula of a diagram?
Calculate the average molarity of the naoh solution : An analyst is to determine the molarity of a NaOH solution. Three aliquots of standard KHP are weighed out: 0.3174 g, 0.4949 g, and 0.3869 g. These three aliquots were titrated using a NaOH solution and required 15.34 mL, 24.23 mL, and 18.59 mL, resp..
How would you convert 75 kilometers/sec to meters/sec : How would you convert 75 kilometers/sec to meters/sec?
In the familiar base 10 system : In the familiar base 10 system, the smallest (rightmost) digit of a number is the ones place (100).  The next digit is in the tens place (101), and the next one is in the hundreds place (102) and so forth.  Thus the number 122 is really (1 * 102) + (..
Relationship between intelligence and job satisfaction : What is the relationship between intelligence and job satisfaction? Use facts and studies to support your position. (DuBrin Book, Edition 4e)
Design an incident response plan : Using the format provided in the text, design an incident response plan for your home computer. Include actions to be taken if each of the following events occurs: What other scenarios do you think are important and need a plan?
Consider the following nested loop construct : Consider the following nested loop construct. Categorize its efficiency in terms of the variable n using big-O notation. Suppose the statements represented by the ellipsis require four main memory accesses (each requiring one microsecond) and two dis..
Formulate a linear program thal maximizes the farmers profit : Formulate a linear program thal maximizes the farmers profit - Write a linear model that detennince the minimum cost generation plan.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that finds the equivalent series

Write a program that finds the equivalent series and parallel resistance for a collection of resistor values. Your program should scan first the number of resistors and then the resistor values. Then compute the equivalent series resistance for all r..

  How do you generate arrays, random numbers

How do you generate arrays, random numbers and multiply and add rows, columns and diagonals in C

  A linked list of your song structure in cd

The CD object should have a data member that is a linked list of your song structure that you have in CD.  The CD class needs a function that allows it to add a song to the object, that function would then append the song to that instance of the link..

  Write a function to compute the volume of a cone

write a function to compute the volume of a cone by using the base radius r and the height h of the cone as the parameters of the function Vcone = xr^2h/3

  C program to randomly generate more than ten ip address

Write C or C++ program which Randomly generates more than 10 IP addresses written in decimal format and write results in text file (e.g. Dec_IPAddresses.txt)

  Write a program that will call a function

Write a program that will call a function called writeDataToFile to prompt a user for their first name, last name and zip code, and print this information to a file called "UserData.txt". The main function should prompt the user for the same infor..

  Write a program that asks the user for a profile name

Write a program that asks the user for a profile name and displays the number of characters, words, and lines in that file. Then have the program ask for the name of the next file. When the user enters a file that doesn't exist (such as the empty ..

  Make a program to play lottery

make a program to play lottery. The program randomly generates a Lottery of a three-digit number( any number from 100 to 999), prompts the user to enter a three-digit number, and determines

  Produce a c program to calculate the total price for order

Your friend has just opened a computer appliances shop at Changloon. He asked your help to develop a computer program which can be used at the counter. Your program should be able to input the customer's order which could be more than one item. Produ..

  Provide a class diagram for every user authored class

Examine the sample code you have been provided with. This code is for a simple Car Hire management system. It contains a number of classes.

  Create a program that reads in two integers

Create a program that reads in two integers and then has a pointer point to the first variable and then to the second variable.

  Write a program that uses joptionpanes to perform

For example, if the distance of travel is 30 kilometers, the time of travel is 2 hours, then the speed is 30/2 = 15 (kilometers per hour).

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