Page 311 - CA_Blue( J )_Class9
P. 311

4          public static void main(String ars[])
                   5          {

                   6              Scanner s = new Scanner(System.in);
                   7              int n;

                   8              System.out.print("Enter the number of rows: ");
                   9              n = s.nextInt();
                  10              for(int i=n;i>=1;i--)

                  11              {

                  12                  for(int j=1;j<=i-1;j++)
                  13                  {
                  14                      System.out.print(" ");

                  15                  }
                  16                  for(int k=1;k<=n;k++)

                  17                  {
                  18                      System.out.print("*");

                  19                  }
                  20                  System.out.print("\n");

                  21              }
                  22          }

                  23      }






































                                                                                                Sample Projects  309
   306   307   308   309   310   311   312   313   314   315   316