Javatpoint Logo
Javatpoint Logo

Armstrong Number

An Armstrong number is the one whose value is equal to the sum of the cubes of its digits.

0, 1, 153, 371, 407, 471, etc are Armstrong numbers.

For example,


  • Take the number.
  • Store it in a variable.
  • Take a variable for sum.
  • Divide the number with 10 until quotient is 0.
  • Cube the remainder.
  • Compare sum variable and number variable.

Armstrong number in PHP

Below program checks whether 407 is Armstrong or not.



PHP Armstrong number 1

Look at the above snapshot, the output displays that 407 is an Armstrong number.

Armstrong number using Form in PHP

A number is Armstrong or can also be checked using a form.



On entering the number 371, we got the following output.

PHP Armstrong number 2

On entering the number 9999, we got the following output.

PHP Armstrong number 3
Next TopicPalindrome Number

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA