Page 310 - CA_Blue( J )_Class9
P. 310

7        int n,m;
                     8        System.out.print("Enter the number");

                     9        n =s.nextInt();
                    10        m = 2*n-1;

                    11        for(int i=1;i<=m;i++)
                    12        {
                    13          for(int j=1;j<=m;j++)

                    14          {

                    15             if(i==j || j==(m-i+1))
                    16             {
                    17               System.out.print("*");

                    18             }
                    19             else

                    20             {
                    21               System.out.print(" ");

                    22             }
                    23          }

                    24          System.out.print("\n");
                    25        }

                    26      }
                    27      }


                                  Write a project to draw the following pattern.
                    Project  5





















                     1      import java.util.*;
                     2      class holo_sq

                     3      {



                   308    Touchpad Computer Applications-IX
   305   306   307   308   309   310   311   312   313   314   315