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

Full Pyramid Star Pattern Program in Java  


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

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