Write a JavaScript program to check whether given number is Armstrong number or not.
<html>
<head>
<title>Find number is Armstrong no. or not</title>
</head>
<body>
<script>
var n = parseInt(prompt("Enter number to check for Armstrong no.", "0"));
var res = 0;
for(i = n; i > 0; i = parseInt(i/10))
{
r = i % 10;
res = res + r*r*r;
}
if(n == res)
{
document.write("Number is an Armstrong no.");
}
else
{
document.write("Number is not an Armstrong no.");
}
</script>
</body>
</html>
