Computer Science, asked by juwonolowu52, 3 months ago

Write a JavaScript program to find the Armstrong numbers of 3 digits.

Answers

Answered by n3od4rk3r
0

Answer:

Explanation:

I hope you understand.

Attachments:
Answered by singhrishit33
0

Answer:

let sum = 0;

const number = prompt('Enter a three-digit positive integer: ');

// create a temporary variable

let temp = number;

while (temp > 0) {

// finding the one's digit

let remainder = temp % 10;

sum += remainder * remainder * remainder;

// removing last digit from the number

temp = parseInt(temp / 10); // convert float into integer

}

// check the condition

if (sum == number) {

console.log(`${number} is an Armstrong number`);

}

else {

console.log(`${number} is not an Armstrong number.`);

}

Explanation:

pls Mark me brainleist

Similar questions