[Solved] Printing Diamonds Java Output not exactly as required

[ad_1]

You can modify your inner loop logic when printing lower half of the diamond.

   //Printing j *'s at the end of each row 
int mid = (row+1) / 2;
    for (int j = row; j > 0; j--) 
    {
        if(i==0 && j==mid) System.out.print("o ");
            else System.out.print("* ");
    }

3

[ad_2]

solved Printing Diamonds Java Output not exactly as required