set A = { x such that x element N and sum of digits in x is same as number of digit of x }
( i ) Check whether set A is finite or not ?
Answers
Answered by
1
Answer:
Find a number x such that sum of x and its digits is equal to given n.
Given a positive number n. We need to find a number x such that sum of digits of x to itself is equal to n.
If no such x is possible print -1.
Examples:
Input : n = 21
Output : x = 15
Explanation : x + its digit sum = 15 + 1 + 5 = 21
Input : n = 5
Output : -1
Similar questions