0
Can someone explain the program and help me to find out semantic error if possible.
3 Réponses
+ 1
nu=int(input("enter num"))
originalnum= nu
def rever(nu):
rev=0
while (nu>0):
rem=nu%10
rev=(rev*10)+rem
nu//=10
print("\nrev is",rev)
if originalnum ==rev:
print(originalnum ,"is palindrome")
else:
print(originalnum ,"is not a palindrome")
rever(nu)
+ 1
This code return the reverse of a number and see if its a Palindrome or not, the only mistake is that you did not save the number inputed in another variable because in the end nu will always be zero
0
How , can you rewrite the program.