JavaScript program to find the factors of a number:

python tutorials and learn python

Created with Sketch.

JavaScript program to find the factors of a number:

let number = parseInt(prompt("Enter a number:"));

console.log("The factors of " + number + " are:");
for (let i = 1; i <= number; i++) {
  if (number % i === 0) {
    console.log(i);
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *