Computer Science, asked by hunterrr, 1 year ago

write a program to read an integer and find its reverse. note: if user enter 1234 then the output should be 4321 in Python

Answers

Answered by antra79
5

Reverse Number In Python

# Python Program to Reverse a Number using While loop.

Number = int(input("Please Enter any Number: "))

Reverse = 0.

while(Number > 0):

Reminder = Number %10.

Reverse = (Reverse *10) + Reminder.

Number = Number //10.

print("\n Reverse of entered number is = %d" %Reverse)

Answered by rp869546
5

Main part is here :

n=sc.nextInt();

int p,rev=0;

while(n>0)

{

p=n%10;

rev=rev*10+p;

n=n/10;

}

System.out.print("Reverse :"+rev);

Similar questions