Overclock.net banner

1 - 2 of 2 Posts

·
Registered
Joined
·
1,090 Posts
Discussion Starter #1
Hey guys just a little lab i am doing I have to draw a triangle like this

**********
*********
********
*******
******
*****
****
***
**
*

So i wrote a loop for it

Code:

Code:
for (row = 0,column = 10;row < 10;row++,column--){

    for (spce = 0; spce < row;spce++)

    {
        System.out.print( " " );

    }

    for (spce =0;spce < column;spce++)

    {

         System.out.print( "*" );

    }

    System.out.print("\n");

}
Now I have to have the triangle upside down so I wrote this loop that is not printing anything.

Code:

Code:
for (row = 0,column = 0;row > 10;row++,column++){

    for (spce = 8; spce < row;spce--)

    {
        System.out.print( " " );

    }

    for (spce = 8; spce < column; spce--)

    {

         System.out.print( "*" );

    }

   // System.out.print("\n");

}
Even a hint as to what i have done wrong would be appreciated, im sure its a logical error I feel kinda silly having to ask since i managed the first triangle
rolleyes.gif
 
1 - 2 of 2 Posts
Top