# Program to find all Armstrong numbers (PHP)

An Armstrong number is an n digit number, which is equal to the sum of the nth powers of its digits. All the 1 digit numbers (1-9) are Armstrong number because 1*1=1 which is equals to number (1) itself, 2*1=2 which is equals to number(2) itself so on for all the 1 digit numbers (1-9).There are no 2 digit Armstrong numbers. Feel free to ask me if you still have doubt.

 1 `0)` 14 ` {` 15 ` \$rem=\$num%10;` 16 ` \$power=pow(\$rem,\$len);//Raise to the power of length of each digit in a number.` 17 ` \$sum=\$sum+\$power; //Sum of power of all digits of a number` 18 ` \$num=\$num/10; // Calculate next number ` 19 ` }` 20 ` if(\$sum==\$i)` 21 ` {` 22 ` echo \$i . "= Yes
";` 23 ` } ` 24 ` } ` 25 `}` 26 `?>`

by hitesh on 19-Aug-2016 06:32 pm
Nice
•  1 Like
•  2 Dislike
• Report
by Deepak on 19-Mar-2015 11:33 pm
Wrong program not working
•  2 Like
•  3 Dislike
• Report
by jithesh on 09-Dec-2014 12:53 pm
im not getting the output \'_\'!
•  2 Like
•  4 Dislike
• Report
by Happy on 12-Nov-2014 04:43 pm
Very nice
•  29 Like
•  5 Dislike
• Report
by Miguel on 19-Sep-2014 01:22 am
Thank you for your code, it really helped me.
•  9 Like
•  2 Dislike
• Report
by gjghj on 09-Aug-2014 02:18 pm
xcfgxd