Until now, we saw how to use loops and conditionals. Let's now move a step further and solve a tougher problem. Here you will reverse a number.
If you feel this was a tough problem, let's see Sajan break it down and create flow diagram for the same.
Now that you have a flow diagram, it now seems like a trivial problem. How about you try and write a code for it now if you weren't able to earlier. If you are still having a tough time to understand how to code this, here is a video of Sajan converting the same logic to code.
You just saw how having the right path or approach to any problem makes the problem easy and trivial. One should not focus on coding the problem but on deciding how to approach it and what algorithm to use and try and build a flow diagram for it. This is how we will always approach every problem. Let's see if you can solve the next one.