A number is said to be a Spy number if the sum of all the digits is equal to the product of all digits.
Input : 1412 Explanation : sum = (1 + 4 + 1 + 2) = 8 product = (1 * 4 * 1 * 2) = 8 since, sum == product == 8 Output : Spy Number Input : 132 Explanation : sum = (1 + 3 + 2) = 6 product = (1 * 3 * 2) = 6 since, sum == product == 6 Output : Spy Number
The number is a Spy number
This article is contributed by Chinmoy Lenka. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Find smallest number with given number of digits and sum of digits
- Find the Largest number with given number of digits and sum of digits
- Minimum number of digits to be removed so that no two consecutive digits are same
- Smallest number with given sum of digits and sum of square of digits
- Check if the sum of digits of number is divisible by all of its digits
- Sum of the digits of square of the given number which has only 1's as its digits
- Number of digits in the nth number made of given four digits
- Find maximum number that can be formed using digits of a given number
- Number of times a number can be replaced by the sum of its digits until it only contains one digit
- Build Lowest Number by Removing n digits from a given number
- Find the smallest number whose digits multiply to a given number n
- Print a number strictly less than a given number such that all its digits are distinct.
- Find count of digits in a number that divide the number
Improved By : jit_t