Home >>Java Programs >Java Program to Print the following pattern
Here we will see a Java program through which we will print the above-given pattern on the console.
Algorithm:
public class Main
{
public static void main(String[] args)
{
int size ;
size =6;
for (int i = size; i != 0; i--)
{
for (int j = 0; j<size-i; j++)
{
System.out.print(" ");
}
for (int k = 0; k < (2 * i - 1); k++)
{
System.out.print("*");
}
System.out.println();
}
}
}