Write a program that goes through all the numbers from 1 to 50 and for each one prints on the screen if the number is even or odd. If the number is also prime, the program should say you are cousin.
I can't think of a way to run the code so that it prints the even, odd, and prime numbers together. Example: 1 Odd 2 Prime and Pair 3 Prime and Odd 4 Pair
I only solved part of this problem.
function nPrime(n){
if(n == 1) return false;
for(var i = 2; i < n; i++){
if(n % i == 0) return false;
}
return true;
}
let num = 50;
for(var i = 1; i <= num; i++){
if(nPrime(i)){
console.log(i + " Prime");
}
}