Computer Science Homework Solutions
Problem
#130836

Visual C++ program

Write a C++ program to output the binary (base-2) representation of a decimal integer. The algorithm for this conversion is to be repeated dividing the decimal number by 2 until it is 0. Each division produces a remainder of 0 or 1 which becomes a digit in the binary numbers.


example the decimal number 25

25/2 = 12 remainder 1
12/2 = 6 remainder 0
6/2 = 3 remainder 0
3/2 - 1 remainder 1
1/2 = 0 remainder 1

Solution
What is this?
By OTA - Overall OTA Rating
Yupei Xiong, PhD - 4.8/5
Purchase Cost Now
$2.19 CAD (was ~$15.96)
Included in Download
  • Plain text response
  • Attached file(s):
    • 130836.cpp
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
Browse