Skip to content

Commit ea159f9

Browse files
Add files via upload
1 parent 8075c07 commit ea159f9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Array-Lists/Arraysist.java

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import java.util.Scanner;
2+
3+
public class Arraysist {
4+
public static void main(String[] args) {
5+
Scanner input = new Scanner(System.in);
6+
int twoD[][] = new int[10][] ;
7+
twoD[0] = new int[1] ;
8+
twoD[1] = new int[2] ;
9+
twoD[2] = new int[3] ;
10+
twoD[3] = new int[4] ;
11+
twoD[4] = new int[5] ;
12+
twoD[5] = new int[6] ;
13+
twoD[6] = new int[7] ;
14+
twoD[7] = new int[8] ;
15+
twoD[8] = new int[9] ;
16+
twoD[9] = new int[10] ;
17+
18+
int i , j , k = 0 ;
19+
20+
for( i = 0 ; i < 10 ; i++)
21+
for( j = 0 ; j < i + 1 ; j++) {
22+
twoD[i][j] = k ;
23+
k++ ;
24+
}
25+
26+
for( i = 0 ; i < 10 ; i++) {
27+
for( j = 0 ; j < i + 1 ; j++)
28+
System.out.print(twoD[i][j] + " ");
29+
System.out.println();
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)