## Find Armstrong Number

An Armstrong number is sum of the cubes of its digits is equal to the number itself.

## There are six Armstrong numbers in the range of 0 and 999.

Armstrong number 1: 0
Armstrong number 2: 1
Armstrong number 3: 153
Armstrong number 4: 370
Armstrong number 5: 371
Armstrong number 6: 407

## PHP Program Logic for Armstrong Number:

1. First You have to take the number.
2. Than taken number store it in a another variable.
3. Take a variable for sum.
4. Divide the number with 10 until quotient is 0.
5. Cube the remainder.
6. Compare sum variable and number variable.

## PHP program to find Armstrong number

```<?php
\$num = 407;
\$total = 0;
\$temp = \$num;
while(\$temp!=0)
{
\$rem = \$temp%10;
\$total = \$total+\$rem*\$rem*\$rem;
\$temp = \$temp/10;
}
if(\$num == \$total)
{
echo "Yes it is an Armstrong number";
}
else
{
echo "No it is not an armstrong number";
}
?>
```

## PHP program to find Armstrong number using HTML Form

```<form method="post">
<input type="text" name="number" placeholder="Enter number" />
<input type="submit" value="Submit" />
</form>
<?php
if(isset(\$_POST['number']))
{
\$num = \$_POST['number'];
\$total = 0;
\$temp = \$num;
while(\$temp!=0)
{
\$rem = \$temp%10;
\$total = \$total+\$rem*\$rem*\$rem;
\$temp = \$temp/10;
}
if(\$num == \$total)
{
echo "Yes it is an Armstrong number";
}
else
{
echo "No it is not an armstrong number";
}
}
?>
```

Program Keywords: armstrong numbers list, armstrong numbers between 1 to 999, armstrong number program, armstrong numbers between 1 to 500, armstrong number php, armstrong number in c++, armstrong number program in php, armstrong number algorithm, find armstrong number, print armstrong number ##### Mukesh Jakhar

This is Mukesh Jakhar. I’m a professional web developer with 3+ years experience. I am always ready for freelance work and i am writing blogs in my free time. I love to learn new technologies and share with others.

I founded PHPKIDA in September 2015. The focus of this website to provide web development tutorials of PHP, WordPress, CodeIgniter, Jquery, MySQL, HMTL, CSS etc and sharing solution to problems which i already solved.

15/01/2020

15/01/2020

12/01/2020