javascript program to find armstrong number
<script>
var n=prompt("enter the number");
n1=n;
var sum=0,r;
while(n!=0)
{
r=n%10;
sum=sum+(r*r*r);
n=parseInt(n/10);
}
if(sum==n1)
alert("number is armstrong");
else
alert("number is not armstrong");
</script>
<script>
var n=prompt("enter the number");
n1=n;
var sum=0,r;
while(n!=0)
{
r=n%10;
sum=sum+(r*r*r);
n=parseInt(n/10);
}
if(sum==n1)
alert("number is armstrong");
else
alert("number is not armstrong");
</script>
0 comments: