PROBLEM 29
Easy

Reverse a Two-Digit Number

Programming Basics · Python

</>
STATUS Not solved

TASK

Problem

#29

Given a positive two-digit integer, swap its digits and print the resulting number.

EXAMPLE

Example

Input
42
Output
24

LIMITS

Constraints

10 ≤ n ≤ 99
📖
LEARN Theory for this problem
+

`input()` reads data entered by the user. The result of `input()` is initially a string. `int()` converts a numeric string into an integer. The `+` operator adds numbers. The `*` operator multiplies numbers. The `//` operator performs integer division and keeps the whole-number part. The `%` operator returns the remainder after division. `print()` displays the program result. Print only what the problem statement requires.

**Connection to this task.** The `//` and `%` operators complement each other: the first gives the integer quotient and the second gives the remainder. This is useful when splitting a number into groups or digits. The expression `b * 10 + a` shows how this idea is applied to the task data.

💡
NEED HELP? Hints
+

['Extract tens and ones with `// 10` and `% 10`.']

ANSWER Solution
+
n = int(input())
a = n // 10
b = n % 10
print(b * 10 + a)