Skip to content

Instantly share code, notes, and snippets.

@rvbsanjose
Last active May 5, 2022 11:46
Show Gist options
  • Save rvbsanjose/10813768 to your computer and use it in GitHub Desktop.
Save rvbsanjose/10813768 to your computer and use it in GitHub Desktop.
// Using the JavaScript language, 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.
// Input = 19 Output = true
// Input = 110 Output = false
function PrimeTime( num ) {
for ( var i = 2; i < num; i++ ) {
if ( num % i == 0 )
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment