Prime no. In JavaScript

Write a program to accept a no. from user and print whether it is prime or not.

Enter A Number:
<HEAD><title>Prime no. In JavaScript</title>
function chkprime()  
  {     var div  
       var no=parseInt(frm.t1.value)  
         alert(no + " is Prime number")
       alert(no + " Not Prime number") 
<form name=frm> Enter A Number:<input type=text name=t1 />
<input type='button' value='Is Prime?' onclick="chkprime();">

No comments:

Post a Comment

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog