How to calculate the reverse in a number
What do they mean by calculate the reverse in a number?
see since the constraints are large
0 <= N <= 1000000000
u need to take a string as input
and simply
do a
reverse(s.begin() , s.end() )
and print s
but just in case u need to reverse an integer
then
u need to do something like thi s
int num as initial input
take a integer named rev = 0
while num > 0 :
remainder = num%10
rev = rev*10 + remainder
num/=10
cout << rev
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.