Segitiga Kanan

class segitigakanan
{
 public static void main (String[]args)
 {
     int i,j,k;
     int panjang = 10;


    for (j=0; j<panjang; j++)
     {
         for (k=0; k<j; k++)
         {
          System.out.print(" ");
         }
         for (i=0; i<(panjang-i); i++)
         {
             System.out.print("*");
            }
            System.out.println();
        }
    }
}
OUTPUT:
*****
 *****
  *****
   *****
    *****
     *****
      *****
       *****
        *****
         *****

No comments:

Post a Comment