2 comments:

  1. $i=100;
    while($i!=999)
    {
    $number=0;
    $temp=$i;
    while($temp>=1)
    {
    $number+=pow($temp%10,3);
    $temp/=10;
    }
    if($i==$number)
    echo "$i
    ";
    $i++;
    }

    ReplyDelete
  2. php
    $n=$_POST['num'];
    $temp=$n;
    $rem=0;
    for($i=100;$i<1000;$i++)
    {while($n!=0)
    {$digit=$n%10;
    $rem=$rem+($digit*$digit*$digit);
    $n=$n/10;
    }
    }
    if($temp==$rem)
    echo"it is an armstrong number";
    else
    echo"it is not an armstong number";

    ?>

    ReplyDelete