Untitled

mail@pastecode.io avatar
unknown
plain_text
16 days ago
466 B
1
Indexable
Never
<html> <body>
<h2>Enter the Number</h2><br>
<form action="" method="post">
<input type="text" name="number" />
<input type="submit" />
</form>
</body> </html>
<?php
if( $_POST )
{
$number = $_POST[ 'number' ];
$temp = $number;
$sum = 0;
while( $temp != 0 )
{
$rem = $temp % 10; //find reminder
$sum = $sum + ( $rem * $rem * $rem );
$temp = $temp / 10;
}
if( $number == $sum )
echo "Armstrong Number";
else
echo "Not an Armstrong Number";
}
?>
Leave a Comment