Page 213 - CA_Blue( J )_Class10
P. 213

11                      } else {
                  12                          System.out.print(" ");

                  13                      }
                  14                  }

                  15                  System.out.println();
                  16              }

                  17          }
                  18      }


                  Program 15 Write a program to draw a hollow diamond pattern.



































                   1      import java.util.Scanner;
                   2      class hollow_diamond

                   3      {
                   4      public static void main(String args[])

                   5      {
                   6          int i,j;

                   7          Scanner scan=new Scanner(System.in);
                   8          System.out.print("How many rows do you want?");

                   9          int rows=scan.nextInt();
                  10          System.out.println("Which symbol do you wish to add?");

                  11          char ch=scan.next().charAt(0);



                                                                                                                       211
                                                                                                         Nested Loop   211
   208   209   210   211   212   213   214   215   216   217   218