Q:

Reverse a given integer number using python programming

belongs to collection: Python Loop Exercises

0

Reverse a given integer number

Given:

76542

Expected output:

24567

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

num = 76542
reverse_number = 0
print("Given Number ", num)
while num > 0:
    reminder = num % 10
    reverse_number = (reverse_number * 10) + reminder
    num = num // 10
print("Revere Number ", reverse_number)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Use a loop to display elements from a given list p... >>
<< Write a python program to use the loop to find the...