Given N, check whether it is a Narcissistic number or not.
Note:Narcissistic Number is a number that is the sum of its own digits each raised to the power of the number of digits
Input : 153 Output : yes Explanation: 1^3+5^3+3^3=153 Input : 1634 Output : yes Explanation: 1^4+6^4+3^4+4^4=1634
The approach will be to count the number of digits and then extract every digit and then by using pow function we can get the power of that digit and then sum it up at the end and compare with the original number to check if it is a Narcissistic Number or not.
- Count number of triplets with product equal to given number with duplicates allowed
- Maximum number formed from array with K number of adjacent swaps allowed
- Count number of trailing zeros in Binary representation of a number using Bitset
- Find minimum number to be divided to make a number a perfect square
- Smallest number dividing minimum number of elements in the array | Set 2
- Largest number dividing maximum number of elements in the array
- Given number of matches played, find number of teams in tournament
- Number of ways to split a binary number such that every part is divisible by 2
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Number of times the largest perfect square number can be subtracted from N
- Smallest number dividing minimum number of elements in the Array
- Count number of ways to divide a number in 4 parts
- Find the largest good number in the divisors of given number N
- Represent a number as a sum of maximum possible number of Prime Numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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