Computer Science
Try writing program (similar to previous one) for three digit number i.e., if you input 123, the program should print 321.
Python
Python Data Handling
30 Likes
Answer
x = int(input("Enter a three digit number: "))
d1 = x % 10
x //= 10
d2 = x % 10
x //= 10
d3 = x % 10
y = d1 * 100 + d2 * 10 + d3
print("Reversed Number:", y)
Output
Enter a three digit number: 123
Reversed Number: 321
Answered By
15 Likes
Related Questions
Write a program to take a 2-digit number and then print the reversed number. That is, if the input given is 25, the program should print 52.
Write a program to take two inputs for day, month and then calculate which day of the year, the given date is. For simplicity, take 30 days for all months. For example, if you give input as: Day3, Month2 then it should print "Day of the year : 33".
Write a program that asks a user for a number of years, and then prints out the number of days, hours, minutes, and seconds in that number of years.
How many years? 10
10.0 years is:
3650.0 days
87600.0 hours
5256000.0 minutes
315360000.0 secondsWrite a program to take two numbers and print if the first number is fully divisible by second number or not.