PHP Armstrong Number Program,Check if a number is armstrong number Using PHP,
Armstrong number Program in PHP,
PHP Script to find Armstrong number or not,
Write a PHP program to check if a number is an Armstrong number or not,
Armstrong Number program in PHP with form
armstrong-or-not-in-php-with-form.php
<!DOCTYPE html> <html> <head> <title>Write a program to find whether a number is Armstrong or not in PHP with Form</title> </head> <body> <h2>Armstrong or not in PHP with Form</h2> <form method="post"> <input type="text" name="number" value="" required=""> <input type="submit" name="submit" value="submit"> </form> </body> </html> <?php if(isset($_POST['number']) && $_POST['number']!='') { $number = $_POST[ 'number' ]; $temp = $number; $sum = 0; while($temp != 0 ) { $remainder = $temp % 10; $sum = $sum + ( $remainder * $remainder * $remainder ); $temp = $temp / 10; } if( $number == $sum ) { echo "$number is an Armstrong Number"; }else { echo "$number is not an Armstrong Number"; } } ?>