Write C++ program to convert decimal number to binary using function
belongs to collection: c++ language function and recursion programming exercises
All Answers
total answers (1)
belongs to collection: c++ language function and recursion programming exercises
total answers (1)
I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
Result:
Enter a decimal number: 19
Step 1: 19/2, Remainder = 1, Quotient = 9
Step 2: 9/2, Remainder = 1, Quotient = 4
Step 3: 4/2, Remainder = 0, Quotient = 2
Step 4: 2/2, Remainder = 0, Quotient = 1
Step 5: 1/2, Remainder = 1, Quotient = 0
19 in decimal = 10011 in binary
need an explanation for this answer? contact us directly to get an explanation for this answer