Day 42: All Factors of a Number of 100DaysCodingChallenge
Hello all,
#day42
Day42
Today's my task was to Write a Program to Display all Factors of a Number entered by User.
I have started the 100 days of coding challenge to improve my programming skills..
Code :
let a = prompt("Enter a Number : ");
console.log("The all the Factors of a Number", a, "\nare : ");
for(let i=1; i <= a; i++) {
// console.log(a % i)
if (a % i == 0) {
console.log(i);
}
}Output :
Happy Coding:)
Thank you...

Comments
Post a Comment