Skip to content

Instantly share code, notes, and snippets.

@ikyamelia
Created August 12, 2021 05:01
Show Gist options
  • Save ikyamelia/c83b4daa17db4a609ec882c9b6de023c to your computer and use it in GitHub Desktop.
Save ikyamelia/c83b4daa17db4a609ec882c9b6de023c to your computer and use it in GitHub Desktop.
Tech Tryout Glints - 03
function PrimeTime(num) {
for (let i = 2; i < num; i++) {
if (num % i === 0) {
return false
}
}
return true;
}
// keep this function call here
console.log(PrimeTime(readline()));

Prime Time

Have the function PrimeTime(num) take the num parameter being passed and return the string true if the parameter is a prime number, otherwise return the string false. The range will be between 1 and 2^16.

Examples

Input: 19
Output: true

Input: 110
Output: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment