Wap to print table of each digit as input given by user

Home  >>  JavaScript Tutorials  >>  Wap to print table of each digit as input given by user

Wap to print table of each digit as input given by user

23
Sep,2017

0

<html>
<head>
<title>Javascript Tutorials</title>
</head>
<body>
<script type=”text/javascript”>

function show2()
{
var m=prompt(“Enter the number: “);
while(m>0)
{
var rem=parseInt(m%10)
document.write(“Table of “+rem + “<br>”);
for(i=1;i<=10;i++)
{

document.write(rem +” * “+i+ ” = “+ (rem*i) + “<br>”);
if(i==10)
{
document.write(“<br><br>”)
}
}
m=parseInt(m/10);
}
}

function show3()
{
var count=0
var m=prompt(“Enter the number: “);
var n=m.length;
// document.write(n+”<br>”+m[0]);

for(i=0;i<n;i++)
{

for(j=1;j<=10;j++)
{
var p=m[i]
//var p=parseInt(m[i])
document.write(“<br>”)
document.write(p + ” * ” +j+ ” = ” + (p * j));
}

document.write(“<br>—————————————<br>”)
}
}

show3()

</script>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *