File tree Expand file tree Collapse file tree 1 file changed +3
-40
lines changed Expand file tree Collapse file tree 1 file changed +3
-40
lines changed Original file line number Diff line number Diff line change 1111public class Exercise01_04 {
1212
1313 public static void main (String [] args ) {
14- int a = 2 ;
15- int b = 3 ;
16- int c = 4 ;
17-
18- for (int i = 0 ; i < 5 ; i ++) {
19- if (i > 0 ) {
20- System .out .print ("\n " );
21- }
22- for (int j = 0 ; j < 3 ; j ++) {
23-
24- if (i == 0 ) {
25- if (j == 0 )
26- System .out .print ("a " );
27- if (j == 1 )
28- System .out .print ("a^2 " );
29- if (j == 2 )
30- System .out .print ("a^3" );
31-
32- } else if (i == 1 ) {
33- System .out .print ("1 " );
34- } else if (i == 2 ) {
35- System .out .print (a + " " );
36- a *= 2 ;
37-
38- } else if (i == 3 ) {
39- System .out .print (b + " " );
40- b *= 3 ;
41-
42- } else {
43- System .out .print (c + " " );
44- c *= 4 ;
45-
46- }
47-
48-
49- }
50-
51-
14+ int num = 4 ;
15+ for (int row = 1 ; row <= num ; row ++) {
16+ System .out .println (row + " " + row * row + " " + row * row * row );
5217 }
53-
5418 }
5519
56-
5720}
You can’t perform that action at this time.
0 commit comments