how to reverse the input number and get the output
Why dont you write a program. It should work as follows using modulus % and division / operator:
143
should give output as 341
.
Google :
Please provide what you have tried already and what problems you are facing with it. Above google search should point you to programs available which you can refer.
If you are trying to reverse it as an integer think in terms of modulus (% operator). I would be more helpful, but it's homework so you should get the value of solving the problem.
Think of tasks like this by breaking them into the steps you'll need to do, and try writing down the steps. Then, see if you can code each step. Here's how I might start sketching:
Get the number. ("12345")
Reverse the number. ("12345 -> "54321")
Print the result. ("54321")
But this isn't enough detail. We don't know how to code step 2 right away. So lets get some more detail:
Get the number. ("12345")
Split the number into a bunch of separate digits. ("12345" -> "1","2","3","4","5")
Reorder the digits in reverse. ("1","2","3","4","5" -> "5", "4", "3", "2", "1")
Combine the reversed digits to make a number ("5", "4", "3", "2", "1" -> "54321")
Print the result. ("54321")
Try coding this. See if you get stuck on a particular step. If you do, try breaking it down again into smaller steps. If you have trouble breaking it down, you could google the step or ask on StackOverflow again. ("How do I split a number into separate digits?")
This is the basic way to solve most homework-style programming problems. Try it out, and come back if you have problems on any step, and ask about that step specifically.