You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
257 B
PHTML
26 lines
257 B
PHTML
5 years ago
|
<?php
|
||
|
|
||
|
$num=153;
|
||
|
$sum=0;
|
||
|
$temp=$num;
|
||
|
while($temp!=0)
|
||
|
{
|
||
|
$rem=$temp%10;
|
||
|
$sum=$sum+$rem*$rem*$rem;
|
||
|
$temp=$temp/10;
|
||
|
}
|
||
|
if($num==$sum)
|
||
|
{
|
||
|
echo "Armstrong number";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo "not an armstrong number";
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
/*
|
||
|
Output
|
||
|
|
||
|
Armstrong number
|