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.
- 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
- Number of digits in the nth number made of given four digits
- Find count of digits in a number that divide the number
- 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
- Print a number strictly less than a given number such that all its digits are distinct.
- Build Lowest Number by Removing n digits from a given number
- Find the smallest number whose digits multiply to a given number n
- Sum of pairwise products
- Round-off a number to a given number of significant digits
- Smallest number by rearranging digits of a given number
Improved By : jit_t