Javascript Prime Number calculator is used to find whether the given value is prime or not. Enter the value into textbox and find whether the given value is prime or not.
Features
You can verify whether the given value is integer or not.
Check given value is prime or not.
This is free javascript calculator.
Copy the code from given textarea and use this calculator.
Preview
Enter value into Textbox to check whether it is prime or not.
Downloads
Javascript Code
<!-- Script by hscripts.com --> <!-- More scripts @www.hscripts.com --><script type="text/javascript"> function pricalc() { var a=frm.txt.value; if(a=="") alert("Enter the value"); else { var num=parseInt(a); var i; for(i=2;i<num;i++) { var n; n=num%i; if(n==0) { alert("Not a Prime Number"); break; } } if(i==num) { alert("Prime Number"); } } } function isInteger(s) { var i; s=s.toString(s); for(i=0;i<s.length;i++) { var c=s.charAt(i); if(isNaN(c)) { alert("Given value is not a number"); frm.txt.value=""; return false; } } return true; } </script><!-- Script by hscripts.com -->
For customization of this script or any script development, mail to support@hscripts.com
Usage
Copy the javascript code into the head part of your HTML page.
Create a HTML form using the above HTML code.
Here,the function "pricalc()" is called to check whether the given value is prime or not. The function "isInteger()" is used to check the entered value is integer or not.
Copy the code into your page and use this calculator.