🪔 शुभ नवरात्रि!    Use Code: FESTIVALOFF300    Invoke the power of knowledge – Get ₹300 to ₹800 OFF on Java Courses 🎊
Celebrate & Learn 🙏

V Shape Star Pattern Program in Java  


Program:
*       *
 *     *
  *   *
   * *
    *
  • Program:
    public class StarPattern10
    {
        public static void main(String[] args)
        {
            for (int i=5; i>=1; i--)
            {
                for (int j=5; j>i; j--)
                {
                    System.out.print(" ");
                }
    
                for (int k=1; k<=(2*i-1); k++)
                {
                    if (k==1 || k==(2*i-1))
                    {
                        System.out.print("*");
                    }
                    else
                    {
                        System.out.print(" ");
                    }
                }
    
                System.out.println();
            }
        }
    }