File tree 1 file changed +58
-0
lines changed
1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+ public class Array {
3
+
4
+ public static void main (String [] args ) {
5
+
6
+ Scanner s1 =new Scanner (System .in );
7
+
8
+ System .out .print ("Enter the Limit :- " );
9
+ int n1 =s1 .nextInt ()+1 ;
10
+
11
+ int nums [][]=new int [n1 ][]; //Jagged Array Declaration
12
+
13
+ //Array Initialization
14
+ for (int i =0 ;i <nums .length ;i ++)
15
+ {
16
+ nums [i ]=new int [11 ]; //Every Row Size 10
17
+
18
+ for (int j =0 ;j <nums [i ].length ;j ++)
19
+ {
20
+
21
+ nums [i ][j ]=i *j ; //Calculate Table Logic Here
22
+
23
+ }
24
+ }
25
+
26
+ int sum =11 ;
27
+ //One more Printing logic you can skip also
28
+ if (n1 <=10 )
29
+ {
30
+ System .out .println ("\n \t \t \t \t \t \t \t 1 Table " +(n1 -1 )+"\t \n " );
31
+ }
32
+ else
33
+ {
34
+ System .out .println ("\n \t \t \t \t \t \t \t 1 Table 10\t \n " );
35
+ }
36
+
37
+ //Array Printing
38
+ for (int i =1 ;i <nums .length ;i ++)
39
+ {
40
+ if (i <nums .length && i ==sum )
41
+ {
42
+ sum =sum +10 ;
43
+ System .out .println ("\n \t \t \t \t \t \t \t " +(i )+" Table " +(sum -1 )+"\t \n " ); //One more Printing logic you can skip also
44
+ }
45
+
46
+ for (int j =1 ;j <nums [i ].length ;j ++)
47
+ {
48
+
49
+ System .out .print (i +" * " +j +" = " +nums [i ][j ]+"\t " ); //Table Printing Logic
50
+
51
+ }
52
+ System .out .println ();
53
+
54
+ }
55
+
56
+ }
57
+
58
+ }
You can’t perform that action at this time.
0 commit comments