Whats in this post?
- Background and Explanation of the code
- Download Code
To copy code: Click “View Source” on the right of this code snippet.
Background and Explanation of the code
1. In this program we enter a decimal number 62. Now we go on dividing the entered number by 2 and store the result in the array.
Therefore , a = 0, a = 1,. . . . . . a = 1
then we print the elements of array in reverse order and get the result.
Enter the decimal number : 62 (Press Enter)
The binary equivalent is: 111110