Write a C++ program to output the binary

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 Summary

Write a C++ program to output the binary (base-2) representation of a decimal integer.