Armstrong Number Problem Statement
You are provided an integer 'NUM'. Determine if 'NUM' is an Armstrong number.
Explanation:
An integer 'NUM' with 'k' digits is an Armstrong number if the sum of its digits, each raised to the power of 'k', equals the number itself.
Input:
T, followed by T values of NUM
Output:
For each NUM, output 'YES' if it's an Armstrong number, 'NO' otherwise.
Example:
Input:
2
153
123
Output:
YES
NO
Explanation: '153' is an Armstrong number, whereas '123' is not.
Constraints:
1 <= T <= 100
1 <= NUM <= 10^9
- Time Limit: 1 sec
Note:
Just implement the function as described; printing is handled for you.
AnswerBot
4d
An Armstrong number is a number that is equal to the sum of its own digits raised to the power of the number of digits.
Iterate through each digit of the number and calculate the sum of each digit rais...read more
Help your peers!
Add answer anonymously...
Top Accenture Associate Software Engineer interview questions & answers
Popular interview questions of Associate Software Engineer
Top HR questions asked in Accenture Associate Software Engineer
>
Accenture Associate Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app