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.
- Maximum number formed from array with K number of adjacent swaps allowed
- Find minimum number to be divided to make a number a perfect square
- Count number of trailing zeros in Binary representation of a number using Bitset
- Count number of triplets with product equal to given number with duplicates allowed
- Number of times the largest perfect square number can be subtracted from N
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Given number of matches played, find number of teams in tournament
- Querying maximum number of divisors that a number in a given range has
- Build Lowest Number by Removing n digits from a given number
- Print a number strictly less than a given number such that all its digits are distinct.
- Count number of ways to divide a number in 4 parts
- Program to Convert Octal Number to Binary Number
- Find count of digits in a number that divide the number
- Represent a number as a sum of maximum possible number of Prime Numbers
- Find the largest good number in the divisors of given number N
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