here there is a new challenge for you: reverse an integer!
i know, it is quite an easy challenge... but to make things a little more difficult you can only use math operations! built in functions, arrays, vectors or similar must not be used (easy anyway, don't worry :D)
code in any language you want and show us your skills!
happy coding :)
try it guys ☺
//works for every integer , doesn't matter wherther u put 0's in front or u enter negative integer
//by using 2 methods ::: loops and recursion ☺
Slight modification to my previous code that actually reverses the integer as a whole instead of printing out each individual digit in the loop:
num = int(input("Enter an integer to reverse: "))
rev_num = 0
while num != 0:
rev_num = (rev_num * 10) + (num % 10)
num //= 10