Check Armstrong Number Problem

Check Armstrong Number Problem — ExecCode School DSA Practice

Solve the Check Armstrong Number problem on ExecCode. Free online school DSA practice in Numbers & Math Logic. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a number. Your task is to first, count how many digits are in this number. Then, take each digit and multiply it by itself that many times. Add up all these results. If this final sum is exactly the same as the original number, print 'Yes'; otherwise, print 'No'.

Examples

Input 153; Output Yes. Input 120; Output No

Constraints

1 <= N <= 10^6

Practice Check Armstrong Number free on ExecCode. Browse DSA problems, topic map, and placement guides.