programming-examples/php/Basics/Armstrong number Program in PHP.php

26 lines
257 B
PHP
Raw Permalink Normal View History

2019-11-18 14:44:36 +01:00
<?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