A special two-digit number is a number such that when the sum of the digits of the number is added to the product of its digits, the result is equal to the original two-digit number.
input : 59. output : 59 is a Special Two-Digit Number Explanation: Sum of digits = 5 + 9 = 14 Product of its digits = 5 x 9 = 45 Sum of the sum of digits and product of digits = 14 + 45 = 59 input: 29 output: 29 is a Special Two-digit Number Explanation: Sum of digits = 9 + 2 = 11 Product of digits = 9 * 2 = 18 Sum of the sum of digits and product of digits = 11 + 18 = 29
Extract the first and last digit of the number and add and multiply the digits separately. Then, add the sum and product of the digits of the two-digit number and compare it to the original number. If they are same, then it is a Special Two-Digit Number, else it is not.
Below is the implementation of above approach:
59 is a Special Two-Digit Number
- Check input character is alphabet, digit or special character
- Count of Numbers in Range where first digit is equal to last digit of the number
- Find the remainder when First digit of a number is divided by its Last digit
- Largest number less than N with digit sum greater than the digit sum of N
- Generate a number such that the frequency of each digit is digit times the frequency in given number
- Number of times a number can be replaced by the sum of its digits until it only contains one digit
- Largest number less than N whose each digit is prime number
- Count the number of occurrences of a particular digit in a number
- Number of n digit numbers that do not contain 9
- Least Greater number with same digit sum
- Nth number whose sum of digit is multiple of 10
- Sum of digit of a number using recursion
- Find the Number which contain the digit d
- Number of occurrences of 2 as a digit in numbers from 0 to n
- Largest and smallest digit of a number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t