Day 39: Prime Number or not of 100DaysCodingChallenge

Hello all, 

I have started the 100 days of coding challenge to improve my programming skills..

Today is the Day39 of 100DaysCodingChallenge for 

to check whether an input Number taken by the user is a Prime Number or not.

Code : 

let a = prompt("Enter a : ");
if (a % a == 0 && a  % 1 == 0) {
  console.log(a, "Number is a Prime Number.");
} else {
  console.log(a, "Number is not a Prime Number.");
}

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