A spy number is a number where the sum of its digits equals the product of its digits. For example, 1124 is a spy number, the sum of its digits is 1+1+2+4=8 and the product of its digits is 1*1*2*4=8.
Is 1241 a spy number?
Input : 22 Output: Given number is a SPY number. Explanation: Sum of the number is 4 (2 + 2) Product of the number is as 4 (2 * 2) Input : 1241 Output: Given number is not a SPY number.
Is 22 a spy number?
Input number is 22. Let's check it by using the logic of Spy number. As we notice here both the sum value and product value are the same. Hence, 22 is a Spy number.