Loop problem 1

Suman Barik
0

 Question 1: Write a program to print the following pattern :

****

***

**

*


// Use this editor to write, compile and run your Java code 


public class HelloWorld {

public static void main(String[] args) {

    // Practice Problem 1

        int n = 4;

        for (int i=n; i>0; i--){

            for(int j=0;j<i;j++){

                System.out.print("*");

            }

            System.out.print("\n");

        }


}

}

Post a Comment

0Comments
Post a Comment (0)