<html>
<head><title> </title>
</title></head>
<body>
<script>
num=prompt("Enter the 3-digit number");
num=parseInt(num);
org=num;
res=0;
q=parseInt(num/10);
r=num%10;
res+=r*r*r;
num=q;
q=parseInt(num/10);
r=num%10;
res+=r*r*r;
num=q;
q=parseInt(num/10);
r=num%10;
res+=r*r*r;
num=q;
console.log(num);
result=org==res?"Armstrong":"not";
document.write(result);
</script>
</body>
</html>
Write a program to check three digit number is Armstrong or not without using if and loop only using ternary operator
April 28, 2026 in Javascript






