CSC103 Homework 4 Solutions

From dftwiki3
Revision as of 09:04, 22 April 2011 by Thiebaut (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 10:02, 22 April 2011 (EDT)


Solutions for Homework #4

Homework #4
Kristina Fedorenko


Program #1

<html>
<body>
<script language="JavaScript" type="text/javascript"><!--
document.write(<h1><b>CSC103 Homework #4</b></h1>)
document.write(<h3><b>Kristina Fedorenko</b></h3>)
document.write(<h3><b>CSC 103</b></h3>)
document.write(<h4><b>Table of multiplication of 5</b></h4>)

var i;  
for ( i = 1;  i <= 10; i++ ) {
    document.write(5 + " x " + i + " = " + 5*i +"<br>")
}

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

Program #2

<html>
<body>
<script language="JavaScript" type="text/javascript"><!--
document.write(<h1><b>CSC103 Homework #4</b></h1>);
document.write(<h3><b>Kristina Fedorenko</b></h3>);
document.write(<h3><b>CSC 103</b></h3>);
document.write(<h4><b>Table of multiplication of 5 (with bullets)</b></h4>);
document.write("<ul>");

var i;  
for ( i = 1;  i <= 10; i++ ) {
    document.write("<li>"+5 + " x " + i + " = " + 5*i);
}

document.write("</ul>");

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

Program #3

<html>
<body>
<script language="JavaScript" type="text/javascript"><!--
document.write(<h1><b>CSC103 Homework #4</b></h1>);
document.write(<h3><b>Kristina Fedorenko</b></h3>);

<!-- outer loop, creates a multiplication table for numbers 2 - 9 -->
var j;
for (j=2; j<=9; j++){
   document.write("<b>Table of multiplication of " + j + "</b>" );
   document.write("<ul>");


   <!-- inside loop, creates a single entry of the multiplication table -->
   var i;  
   for ( i = 1;  i <= 10; i++ ) {
      document.write("<li>"+ j + " x " + i + " = " + j*i);
   }
   document.write("</ul>");
}

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