Question bank › Math
Dsa Math Medium

Armstrong Number Identification

An Armstrong number (also known as a narcissistic number) for a given number of digits n is a number that is equal to the sum of its own digits each raised to the power of n. Write a program that identifies whether a number is an Armstrong number. Input Format: - A single integer, n (1 <= n <= 6), where n is the number of digits. - A second line containing the integer x (0 <= x < 10**6). Output Format: - Print 'Yes' if x is an Armstrong number, otherwise print 'No'. Example: Input: 3 153 Output: Yes (153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153)

Key concepts

mathstringsloops

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.