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

Popular posts from this blog

Day 100: Date Time to Number of 100DaysCodingChallenge

Day 64: Pattern using loops of 100DaysCodingChallenge

Day 20: Positive Number of 100DaysCodingChallenge