How to reverse it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to reverse it?

I'm trying to give binary number as an output but output is reverse of what's correct https://code.sololearn.com/c8YH8HYl6OqE/?ref=app

1st Jul 2020, 1:30 AM
zexu knub
zexu knub - avatar
5 Answers
+ 2
Zexu Knub Please try this code.. I have just modified a little bit.. https://code.sololearn.com/cT0q7P436VQ6/?ref=app
1st Jul 2020, 6:14 AM
Akash Saha
Akash Saha - avatar
+ 2
Don't print them in the inner while loop.. store them in the char array and then reverse it.
1st Jul 2020, 2:04 AM
Akash Saha
Akash Saha - avatar
+ 1
Zexu Knub you are welcome.
1st Jul 2020, 6:23 AM
Akash Saha
Akash Saha - avatar
0
Akash Saha i edited the code but it's still giving the wrong output ( garbage values) except for 1
1st Jul 2020, 6:02 AM
zexu knub
zexu knub - avatar
0
Akash Saha thanks for the help
1st Jul 2020, 6:23 AM
zexu knub
zexu knub - avatar