Skip to content

Commit c4e1b78

Browse files
Add the Squares class
1 parent 698e81a commit c4e1b78

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.guide.c5;
2+
3+
// Initialize a two-dimensional array.
4+
public class Squares {
5+
public static void main(String[] args) {
6+
int[][] sqrs = {
7+
{ 1, 1 },
8+
{ 2, 4 },
9+
{ 3, 9 },
10+
{ 4, 16 },
11+
{ 5, 25 },
12+
{ 6, 36 },
13+
{ 7, 49 },
14+
{ 8, 64 },
15+
{ 9, 81 },
16+
{ 10, 100 }
17+
};
18+
int i, j;
19+
20+
for (i = 0; i < 10; i++) {
21+
for (j = 0; j < 2; j++)
22+
System.out.print(sqrs[i][j] + " ");
23+
System.out.println();
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)