JavaScript Program to Display Armstrong Numbers Between 1 to 1000 Last Updated : 19 Feb, 2024 Comments Improve Suggest changes Like Article Like Report Armstrong number is a number equal to the sum of its digits raised to the power 3 of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153. This article will explore how to find Armstrong numbers between 1 to 1000 using JavaScript. Approach 1: Display Armstrong Numbers Between 1 to 1000 using a LoopThe simplest approach to finding Armstrong numbers is using a loop to iterate through each number from 1 to 1000 and check if it is an Armstrong number. JavaScript function isArmstrong(number) { let sum = 0; let temp = number; const digitsCount = number.toString().length; while (temp > 0) { let digit = temp % 10; sum += Math.pow(digit, digitsCount); temp = Math.floor(temp / 10); } return sum === number; } // Driver code let N = 1000; for (let i = 1; i <= N; i++) { if (isArmstrong(i)) { console.log(i); } } Output1 2 3 4 5 6 7 8 9 153 370 371 407Approach 2: Display Armstrong Numbers Between 1 to 1000 using Array MethodsWe can also use JavaScript array methods to make the code more concise and functional. In this approach, we convert the number to a string, split it into an array of digits, and then use the reduce method to calculate the sum of each digit raised to the power of the number of digits. JavaScript function isArmstrong(number) { return number === number .toString() .split('') .reduce((sum, digit, _, { length }) => sum + Math.pow(digit, length), 0); } // Driver code N = 1000; for (let i = 1; i <= N; i++) { if (isArmstrong(i)) { console.log(i); } } Output1 2 3 4 5 6 7 8 9 153 370 371 407 Comment More infoAdvertise with us Next Article JavaScript Numbers Coding Practice Problems V vkash8574 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Numbers JavaScript-Questions Similar Reads JavaScript Program to Display Armstrong Number Between Two Intervals An Armstrong number is a number that is equal to the sum of its digits each raised to the power of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153. In this article, we'll explore how to create a JavaScript program to display all Armstrong numbers within a 2 min read JavaScript Program for Armstrong Numbers In this article, we will see a JavaScript program to check whether the given number is an Armstrong number or not. An Armstrong Number is an n-digit number that is the sum of the nth power of its all digits. For instance, Consider a 3-digit number, i.e., 153, which is a 3-digit number, & the sum 4 min read JavaScript Numbers Coding Practice Problems Numbers are fundamental in JavaScript, used for calculations, data analysis, and algorithm implementation. This curated list of JavaScript number practice problems covers essential concepts to master JavaScript Numbers. Whether you're a beginner or looking to sharpen your numerical computation skill 1 min read PHP | Check if a number is armstrong number Given a number, we need to check whether it is an armstrong number or not in PHP. An Armstrong number is the one whose value is equal to the sum of the cubes of its digits.Examples: Input : 407 Output : Yes 407 = (4*4*4) + (0*0*0) + (7*7*7) = 64 + 0 + 343 = 407 Input : 303 Output : No Approach: For 2 min read Number in Words | Number Names 1 to 100 Number Names or Numbers in Words are the English words we use to represent/spell numbers. Instead of writing numbers using digits (like 1, 2, 3), we spell them out in words (like one, two, three).The given images below shows the word representation of number names from 1 to 20.Learning number names 8 min read Find largest Armstrong number in an Array Given an array arr[] of size N. The task is to find the largest Armstrong number of the array. Note: An Armstrong number is a number that is equal to the sum of its digits raised to the power of the number of digits in that number. Examples: Input: arr[] = [153, 9474, 1634, 371, 8208, 9475]Output: 9 7 min read Like