check armsstrong number or not

technical talkiess
0

 <?php

$n1 =371;

$n2 = (3*3*3)+(7*7*7)+(1*1*1);

if($n2 == $n1){

echo $n1 ." a armsstrong number";

}else{

echo "not a armsstrong number";

}



$n1 =342;

$n2 = (3*3*3)+(4*4*4)+(2*2*2);

if($n2 == $n1){

echo $n1 ." a armsstrong number";

}else{

echo "not a armsstrong number";

}




?>

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)