Challenge: Crazy Number
An Crazy number is an n-digit positive number such that the sum of its digits raised to the power n is the number itself. Write a program to check whether a number is Crazy number or not. If number is a Crazy number, print "Yes" else "No". See sample test case given below for more clarification. N.B: We are assuming all numbers given are in base 10. Input Specification: First input is an interger t denotes number of test cases. Next there will be t lines denoting t test cases. Each test case line will have a number N for which you have to check whether it is Crazy Number of not. Output Specification: Output contains t lines. ith line output will be either "Yes" or "No" depending on the number in ith test case. Constraints: 0 < t < 2^31 0 < N < 2^63 Sample Input: 3 153 12 1634 Sample Output: Yes No Yes Explanation: There are three test cases. First testcase: 153 is a 3 digit number. So 1^3 + 5^3 + 3^3 = = 1 + 125 + 27 = 153. So, 157 is Crazy number. Second testcase: 12 is a 2 digit number. So 1^2 + 2^2 = 1 + 4 = 5 != 12. So, 12 is not a Crazy number. Third testcase: 1634 is a 4 digit number. So 1^4 + 6^4 + 3^4 + 4^4 = 1 + 1296 + 81 + 256 = 1634. So, 1634 is a Crazy number. Hence the ouput is : Yes No Yes My Program: https://code.sololearn.com/cXme4sSLqqfu/#java /* Edit: Except few peoples everyone else write code for just a simple Armstrong Number Checker. All you need to read the question again specially the Input/output Specifications. and few coders like @Dipta @Rame#1 @Reniel @Yerucham @LukArToDo writes code according to input/output specication but only few of them passes this case ((Constraints: 0 < t < 2^31 0 < N < 2^63)) */