Answer to Question #16510 in C++ for Ashish
Define your own function named TenToBinary, which will convert
a base-10 integer to a base-2 integer. The following steps are
required to be implemented in your program: (1) In your main
function, need to read an arbitrary input integer (nonnegative)
from the keyboard; (2) pass the input integer to your function (3)
convert the input integer which is based-10 to base-2; and (4)
print the binary value (base-2) in your own function. An example
is given as follows, which should be the format of your program
output on the console window (screen) after the execution.
we have to write this in c programming.
using namespace std;
void show_binary(unsigned int u)
while(u > 1)
if((u % 2) == 0)
std::cout << "0";
std::cout << "1";
u = u >> 1;
std::cout << "1" << std::endl;
int number = 142;
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!