Saturday, 24 January 2015

Javascript program to print the following pattern (for n input lines).

<!--Javascript program to print the following pattern (for n input lines).-->
<!--when n=4-->>

01
01 02
01 02 03
01 02 03 04 



<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a;
var n=prompt("Enter a number for the no. of rows in a pattern");
for(var i=1;i<=n;i++)
 {
  for(var j=1;j<=i;j++)
   {
    document.write("0"+j+" ");
   }
   document.write("<br />");
 }
</script>
</head>
<body>
</body>
</html>

No comments:

Post a Comment

Read contacts in iOS using Swift with error handling

Just copy and paste the below code Pre-step before pasting the below code Add below line in AppDelegate.swift file below import statement ...