1.

Write the code using do while loop without effecting the output:<script language="javascript">var prod,b;prod=1;for(b=1;b<=10;b+=3){document.write(b);prod=prod+b*b;}document.write("the final product is" & prod);</script>

Answer»

<script language="javascript">

var prod,b;

prod=1;

b=1;

do

{

document.write(b);

prod=prod+b*b;

b+=3;

}while(b<=10);

document.write("the final prod is" & prod);

</script>



Discussion

No Comment Found

Related InterviewSolutions