<html>
<body>
<script language="javascript">
var a= new Array(2);
var sum=0;
for(var i=0;i<a.length;i++)
{
a[i] = new Array(3);
}
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
a[i][j]=parseInt(prompt("Enter element",0));
}
}
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
sum+=a[i][j]
document.write(a[i][j]+" ");
}
document.write("<br>");
}
document.write("Total sum of element is "+sum);
</script>
</body>
</html>
<body>
<script language="javascript">
var a= new Array(2);
var sum=0;
for(var i=0;i<a.length;i++)
{
a[i] = new Array(3);
}
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
a[i][j]=parseInt(prompt("Enter element",0));
}
}
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
sum+=a[i][j]
document.write(a[i][j]+" ");
}
document.write("<br>");
}
document.write("Total sum of element is "+sum);
</script>
</body>
</html>
No comments:
Post a Comment