Narcissistic number
Submissions: 1191   Accuracy:

45.09%

  Difficulty: Basic   Marks: 1

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:

The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows, a single line of the input containing a positive integer N.
Output:

Print 'Yes' if it is narcissistic,otherwise print 'No'.


Constraints:

1<=T<=100

1<=N<=100000
Example:

Input:

2

407

111

Output:

Yes

No

Explanation:

Testcase 1:- 4^3+0^3+7^3 = 64+0+343 = 407 equals to N.

Testcase 2:- 1^3+1^3+1^3 = 3 is not equal to N.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sahil Chhabra
Author: Sahil_Chhabra


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.