Created
January 20, 2021 17:15
-
-
Save Shariar-Hasan/4ce9cd553b39964bb0cea8f1c61f07bb to your computer and use it in GitHub Desktop.
Finding prime number using Javascript function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPrime(num) | |
{ | |
for (var i = 2; i<num ; i++) | |
{ | |
if(num%i == 0) | |
{ | |
return num+" is not a prime number"; | |
} | |
} | |
return num+" in a prime number"; | |
} | |
console.log(isPrime(89)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment