Half Pyramid Pattern Program in JaProgram

 class Example

{
    public static void main(String args[])
    {
        int n=4;
       
        for(int i=1; i<=n; i++){
            //inner loop-->Space print
             for(int j=1; j<=n-i; j++){
                System.out.print(" ");
            }
            //inner loop-> star print
            for(int j=1; j<=i; j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
}

OUTPUT:

* ** *** ****

Comments

Popular posts from this blog

Write A C Program To Delete A Single Element From An Array

Evolution of Computer Devices