I am just a beginner in php. I have tried to write code for armstrong numbers. I have checked my code by 153. The output of my code is 0.153is not an armstrong number.How can i correct it? Here is my code.
<?php
$n=153;
while($n>1)
{
$b=$n%10;
$c=$b*$b*$b;
$n=$n/10;
$d=$c+$d;
}
if($d==$n)
echo $n."is an armstrong number";
else
echo $n."is not an armstrong number";
?>
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)