Forum : Question 6 of assigment 5
Brief description  about Online courses   join in Online courses
View Aditi  Gupta 's Profile

Question 6 of assigment 5

Kindly plz tell me what is the error in the following code:

<script language= "JavaScript">

for(i=6;i>=0;i--)
{
document.write("<br/>");
for(j=i;j>=0;j--)
{
document.write(i);
}
}

</script>
Asked by Aditi Gupta | Jan 5, 2010 |  Reply now
Replies (3)
View aditi gupta 's Profile
Thank for your guidelines sanjay. It helped me a lot.
Jan 6, 2010
View teacher siliconindia 's Profile
Hi Aditi,
you suppose to print the value of variable j not i, and in for loop of j you have to give (j=1; j<=i; j++).

Regards,
Rajan Singh
Jan 6, 2010
View sanjay s nair 's Profile
for(i=6;i>=1;i--)
{
for(j=1;j<=i;j++)
{
document.write(j);
}
document.write('<br>');
}
Jan 6, 2010