Tuesday, 19 November 2013

Pattern Logical Questions in JavaScript Like:

12345
12345
12345
12345
12345

Ans:

<html>
<head>
<script type="text/javascript">
function f1(){
var num=document.getElementById("txtNum").value;
for(var i=1;i<=5;i++)
{
for(var j=1;j<=5;j++)
{
document.write(j);
}
document.write("<br/>")
}
}

</script>
</head>
<body>
<input type="text" id="txtNum"/>
<br/>
<input type="button" value="Submit" onclick="f1()"/>
</body>
</html>

No comments:

Post a Comment