0
How to reverse a binary number for example 001 into 100
java
9 Respuestas
+ 11
Save the binary number as string, reverse the string. You can search Code Playground for all kinds of string reversing algorithms.
+ 4
Here you go, in C++.
https://code.sololearn.com/c56lLN21bcuF/?ref=app
+ 3
oh, no clue..
try searching on google or in the code playground
+ 3
thanks it works......
+ 1
my question is
if i want a program
to print binary number of any number
for example
if i put x=4
then Output should 100.
+ 1
buddy not
found everywhere i searched
+ 1
@Praveen Patil wrote: << buddy not found everywhere i searched >>
You've probably not enough searched, or in a bad way (not surprising as you even doesn't success to correctly explain your purpose in your main question ;P)
Converting a number to binary could be done by integer divide by 2 (the base of binary) as long as your number is different from zero, and store remainders in a string from right to left... This is necessarly foundable anywhere ^^ (more basic math than programming question, even if base 2 is often related to computers)