# Anyone could explain the Code.....

• 09-22-2011, 08:12 PM
seongchog
Anyone could explain the Code.....
================================================== =========
Not really understand the code anyone could explain for me ....
================================================== =========

Code:

```int i, j;         int a = 0, b = 4;           for (i = 9; i > 0; i-=2) {               System.out.println();               for (j = 0; j<a; j++){                 System.out.print(" ");             }               for (j = 0; j < i; j++){                 System.out.print("*");             }                       a++;         }           for (i = 0; i < 9; i+=2) {               for (j = 0; j < b; j++){                 System.out.print(" ");             }             if(i!=0){                 for (j = 0; j <= i; j++){                     System.out.print("*");                 }             }               System.out.println();             b--;```
================================================== =========

================================================== =========
• 09-22-2011, 08:22 PM
KevinWorkman
Re: Anyone could explain the Code.....
What don't you understand about it? Have you stepped through it with a debugger? Have you stepped through it with a piece of paper and a pencil?
• 09-22-2011, 08:38 PM
seongchog
Re: Anyone could explain the Code.....
Code:

```int i, j;  <------declare i &j int a = 0, b = 4;<-------declare a=0 b=4 for (i = 9; i > 0; i-=2) { < ------ i got 9 rol, i more 0 ,i -=2 System.out.println();      for (j = 0; j<a; j++){ System.out.print(" "); } for (j = 0; j < i; j++){ System.out.print("*"); } a++; } for (i = 0; i < 9; i+=2) { for (j = 0; j < b; j++){ System.out.print(" "); } if(i!=0){ for (j = 0; j <= i; j++){ System.out.print("*"); } } System.out.println(); b--;```