i cant seem to figure out how to get the computer to know even / odd numbers using it for a prime factors. not looking for someone to do it for me just need a nudge in the right direction

create code that asks the user to supply an integer greater than 1 and then display all the prime numbers that multiply together to get the user’s number. If a number is a prime, its only factors are itself and one.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>OddsEvens</title>
</head>
<body>
<script>
var integer;
var factor;
var fn;

integer= 1;
factor= prompt ("plz instert a number greater then 1");
fn= 2;

		if (factor <= integer) {
	 			 alert ("invalid number");
}	 	if (fn / integer) == 0 ){
		 	 alert ("even");
			} 
		





</script>
</body>
</html>
Member Avatar for rajarajan2017
var n = prompt("Check your number", "Type your number here");

n = parseInt(n);

if (n == 0)
   {
   alert("The number is zero");
   }
else if (n%2)
   {
   alert("The number is odd");
   }
else
   {
   alert("The number is even");
   }

thanks that part works i dont fully understand it ill post back in about 10-20

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.