Social Sciences, asked by shiva199829, 1 month ago

Write a program to reverse a given number. Say for example, If the given number is 35(thrity five),
it should be reversed as 53(fifty three)]. If the input given is zero display Output is:0. If the input
is less than zero then display "Number should be positive"
Refer the sample input and output.
Sample Input 1:
Enter The Number:
478
Sample Output 1:
Output is:874
Sample Input 2:
Enter The Number:
-470
Sample Output 2:
Number should be positive​

Answers

Answered by AsminPandit
1

a=int(input("enter the number:"))

if a==0:

print(a)

if a>0:

print(a[::-1])

else:

print("please enter a positive number"

Similar questions