<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var num = document.getElementById("txtNum").value;
var regx = /^[1-9][0-9]*$/;
var checkNum = regx.test(num);
var arr = new Array();
var count=0,count2=0,store=0;
if (checkNum == null || checkNum == "") {
alert("plz enter only and any no..");
}
else {
alert("Enter Successfully");
}
for (var i = 2; i <= num; i++) {
count = 0;
for (var j = 2; j <= i; j++) {
if (i % j == 0) {
count++;
}
}
if (count == 1) {
arr[store] = i;
store++;
count2++;
}
}
document.write("Trim Prime No's are..<br/>");
for (var k = 0; k <= count2; k++) {
if ((arr[k + 1] - arr[k]) == 2) {
document.write("("+arr[k] + "," + arr[k+1]+")" + "<br/>");
}
}
}
</script>
</head>
<body>
<input id="txtNum" type="text" placeholder="Enter Any No.." />
<input id="btnSubmit" type="button" value="Submit" onclick="f1()" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var num = document.getElementById("txtNum").value;
var regx = /^[1-9][0-9]*$/;
var checkNum = regx.test(num);
var arr = new Array();
var count=0,count2=0,store=0;
if (checkNum == null || checkNum == "") {
alert("plz enter only and any no..");
}
else {
alert("Enter Successfully");
}
for (var i = 2; i <= num; i++) {
count = 0;
for (var j = 2; j <= i; j++) {
if (i % j == 0) {
count++;
}
}
if (count == 1) {
arr[store] = i;
store++;
count2++;
}
}
document.write("Trim Prime No's are..<br/>");
for (var k = 0; k <= count2; k++) {
if ((arr[k + 1] - arr[k]) == 2) {
document.write("("+arr[k] + "," + arr[k+1]+")" + "<br/>");
}
}
}
</script>
</head>
<body>
<input id="txtNum" type="text" placeholder="Enter Any No.." />
<input id="btnSubmit" type="button" value="Submit" onclick="f1()" />
</body>
</html>