- Jan 5, 2001
- 3,144
- 10
- 81
It is supposed to calculate the sqare and cube of the numbers 0 to 10 then display them in a table. I can't think of what I'm doing wrong though. I'm sure it's an easy mistake though.
<SCRIPT LANGUAGE = "Javascript">
var 0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
03,
13,
23,
33,
43,
53,
63,
73,
83,
93,
103,
n0,
n1,
n2,
n3,
n4,
n5,
n6,
n7,
n8,
n9,
n10,
n23,
n33,
n43,
n53,
n63,
n73,
n83,
n93,
n103;
n0 = parseInt( 0 );
n1 = parseInt( 1 );
n2 = parseInt( 2 );
n3 = parseInt( 3 );
n4 = parseInt( 4 );
n5 = parseInt( 5 );
n6 = parseInt( 6 );
n7 = parseInt( 7 );
n8 = parseInt( 8 );
n9 = parseInt( 9 );
n10 = parseInt( 10 );
n03 = parseInt( 03 );
n13 = parseInt( 13 );
n23 = parseInt( 23 );
n33 = parseInt( 33 );
n43 = parseInt( 43 );
n53 = parseInt( 53 );
n63 = parseInt( 63 );
n73 = parseInt( 73 );
n83 = parseInt( 83 );
n93 = parseInt( 93 );
n103 = parseInt( 103 );
n0 = 0 * 0;
n1 = 1 * 1;
n2 = 2 * 2;
n3 = 3 * 3;
n4 = 4 * 4;
n5 = 5 * 5;
n6 = 6 * 6;
n7 = 7 * 7;
n8 = 8 * 8;
n9 = 9 * 9;
n10 = 10 * 10;
n03 = 0 * 0 * 0;
n13 = 1 * 1 * 1;
n23 = 2 * 2 * 2;
n33 = 3 * 3 * 3;
n43 = 4 * 4 * 4;
n53 = 5 * 5 * 5;
n63 = 6 * 6 * 6;
n73 = 7 * 7 * 7;
n83 = 8 * 8 * 8;
n93 = 9 * 9 * 9;
n103 = 10 * 10 * 10;
document.writeln( "<TABLE BORDER = '0' WIDTH = '25%'>");
document.writeln( "<COLGROUP>");
document.writeln( "<COL ALIGN = 'left'>");
document.writeln( "<COL SPAN = '3'>");
document.writeln( "</COLGROUP>");
document.writeln( "<THEAD>");
document.writeln( "<TR VALIGN = 'bottom'>");
document.writeln( "<TH>number</TH>");
document.writeln( "<TH>square</TH>");
document.writeln( "<TH>cube</TH>");
document.writeln( "<TR>");
document.writeln( "</THEAD>");
document.writeln( "<TBODY>");
document.writeln( "<TR>");
document.writeln( "<TH>0</TH>");
document.writeln( "<TD>" + n0 + "</TD>");
document.writeln( "<TD>" + n03 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>1</TH>");
document.writeln( "<TD>" + n1 + "</TD>");
document.writeln( "<TD>" + n13 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>2</TH>");
document.writeln( "<TD>" + n2 + "</TD>");
document.writeln( "<TD>" + n23 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>3</TH>");
document.writeln( "<TD>" + n3 + "</TD>");
document.writeln( "<TD>" + n33 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>4</TH>");
document.writeln( "<TD>" + n4 + "</TD>");
document.writeln( "<TD>" + n43 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>5</TH>");
document.writeln( "<TD>" + n5 + "</TD>");
document.writeln( "<TD>" + n53 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>6</TH>");
document.writeln( "<TD>" + n6 + "</TD>");
document.writeln( "<TD>" + n63 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>7</TH>");
document.writeln( "<TD>" + n7 + "</TD>");
document.writeln( "<TD>" + n73 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>8</TH>");
document.writeln( "<TD>" + n8 + "</TD>");
document.writeln( "<TD>" + n83 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>9</TH>");
document.writeln( "<TD>" + n9 + "</TD>");
document.writeln( "<TD>" + n93 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>10</TH>");
document.writeln( "<TD>" + n10 + "</TD>");
document.writeln( "<TD>" + n103 + "</TD>");
document.writeln( "</TR>");
document.writeln( "</TBODY>");
document.writeln( "</TABLE>");
</SCRIPT>
<SCRIPT LANGUAGE = "Javascript">
var 0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
03,
13,
23,
33,
43,
53,
63,
73,
83,
93,
103,
n0,
n1,
n2,
n3,
n4,
n5,
n6,
n7,
n8,
n9,
n10,
n23,
n33,
n43,
n53,
n63,
n73,
n83,
n93,
n103;
n0 = parseInt( 0 );
n1 = parseInt( 1 );
n2 = parseInt( 2 );
n3 = parseInt( 3 );
n4 = parseInt( 4 );
n5 = parseInt( 5 );
n6 = parseInt( 6 );
n7 = parseInt( 7 );
n8 = parseInt( 8 );
n9 = parseInt( 9 );
n10 = parseInt( 10 );
n03 = parseInt( 03 );
n13 = parseInt( 13 );
n23 = parseInt( 23 );
n33 = parseInt( 33 );
n43 = parseInt( 43 );
n53 = parseInt( 53 );
n63 = parseInt( 63 );
n73 = parseInt( 73 );
n83 = parseInt( 83 );
n93 = parseInt( 93 );
n103 = parseInt( 103 );
n0 = 0 * 0;
n1 = 1 * 1;
n2 = 2 * 2;
n3 = 3 * 3;
n4 = 4 * 4;
n5 = 5 * 5;
n6 = 6 * 6;
n7 = 7 * 7;
n8 = 8 * 8;
n9 = 9 * 9;
n10 = 10 * 10;
n03 = 0 * 0 * 0;
n13 = 1 * 1 * 1;
n23 = 2 * 2 * 2;
n33 = 3 * 3 * 3;
n43 = 4 * 4 * 4;
n53 = 5 * 5 * 5;
n63 = 6 * 6 * 6;
n73 = 7 * 7 * 7;
n83 = 8 * 8 * 8;
n93 = 9 * 9 * 9;
n103 = 10 * 10 * 10;
document.writeln( "<TABLE BORDER = '0' WIDTH = '25%'>");
document.writeln( "<COLGROUP>");
document.writeln( "<COL ALIGN = 'left'>");
document.writeln( "<COL SPAN = '3'>");
document.writeln( "</COLGROUP>");
document.writeln( "<THEAD>");
document.writeln( "<TR VALIGN = 'bottom'>");
document.writeln( "<TH>number</TH>");
document.writeln( "<TH>square</TH>");
document.writeln( "<TH>cube</TH>");
document.writeln( "<TR>");
document.writeln( "</THEAD>");
document.writeln( "<TBODY>");
document.writeln( "<TR>");
document.writeln( "<TH>0</TH>");
document.writeln( "<TD>" + n0 + "</TD>");
document.writeln( "<TD>" + n03 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>1</TH>");
document.writeln( "<TD>" + n1 + "</TD>");
document.writeln( "<TD>" + n13 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>2</TH>");
document.writeln( "<TD>" + n2 + "</TD>");
document.writeln( "<TD>" + n23 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>3</TH>");
document.writeln( "<TD>" + n3 + "</TD>");
document.writeln( "<TD>" + n33 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>4</TH>");
document.writeln( "<TD>" + n4 + "</TD>");
document.writeln( "<TD>" + n43 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>5</TH>");
document.writeln( "<TD>" + n5 + "</TD>");
document.writeln( "<TD>" + n53 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>6</TH>");
document.writeln( "<TD>" + n6 + "</TD>");
document.writeln( "<TD>" + n63 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>7</TH>");
document.writeln( "<TD>" + n7 + "</TD>");
document.writeln( "<TD>" + n73 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>8</TH>");
document.writeln( "<TD>" + n8 + "</TD>");
document.writeln( "<TD>" + n83 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>9</TH>");
document.writeln( "<TD>" + n9 + "</TD>");
document.writeln( "<TD>" + n93 + "</TD>");
document.writeln( "</TR>");
document.writeln( "<TH>10</TH>");
document.writeln( "<TD>" + n10 + "</TD>");
document.writeln( "<TD>" + n103 + "</TD>");
document.writeln( "</TR>");
document.writeln( "</TBODY>");
document.writeln( "</TABLE>");
</SCRIPT>
