Problem Statement
The difference between a two-digit number and the number obtained by interchanging its digits is 36. What is the difference between the two digits of the number?
Explanation
Let the two-digit number have tens digit x and units digit y. The number equals 10x plus y. After interchanging digits, the new number equals 10y plus x.
Given: Difference equals 36. Case 1: If original number is larger: 10x plus y minus open parenthesis 10y plus x close parenthesis equals 36. 10x plus y minus 10y minus x equals 36. 9x minus 9y equals 36. 9 times open parenthesis x minus y close parenthesis equals 36. x minus y equals 4. Case 2: If interchanged number is larger: 10y plus x minus open parenthesis 10x plus y close parenthesis equals 36. This gives y minus x equals 4. In both cases, the absolute difference between digits is 4. Example: Number 73 and 37. Difference equals 73 minus 37 equals 36. Digit difference equals 7 minus 3 equals 4.
Code Solution
SolutionRead Only
// Let two-digit number = 10x + y // Where x = tens digit, y = units digit // Interchanged number = 10y + x // Given: |Difference| = 36 // Case 1: Original > Interchanged // (10x + y) - (10y + x) = 36 // 10x + y - 10y - x = 36 // 9x - 9y = 36 // 9(x - y) = 36 // x - y = 4 // Case 2: Interchanged > Original // (10y + x) - (10x + y) = 36 // y - x = 4 // |x - y| = 4 // Example: 73 and 37 // 73 - 37 = 36 // 7 - 3 = 4 ✓
Practice Sets
This question appears in the following practice sets:
