import java.util.Scanner;
class Pat
{
int n,c=100;
public void getData()
{
System.out.print("enter the number of rows");
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
}
public void logic()
{
for(int i=n;i>=1;i--)
{
for(int j=1;j<=c/2-i;j++)
{
System.out.print(" ");
}
for(int k=1;k<=i*2-1;k++)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}
class Test
{
public static void main(String[] args)
{
Pat t=new Pat();
t.getData();
t.logic();
}
}
OUTPUT:
*****************
***************
*************
***********
*********
*******
*****
***
*
class Pat
{
int n,c=100;
public void getData()
{
System.out.print("enter the number of rows");
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
}
public void logic()
{
for(int i=n;i>=1;i--)
{
for(int j=1;j<=c/2-i;j++)
{
System.out.print(" ");
}
for(int k=1;k<=i*2-1;k++)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}
class Test
{
public static void main(String[] args)
{
Pat t=new Pat();
t.getData();
t.logic();
}
}
OUTPUT:
*****************
***************
*************
***********
*********
*******
*****
***
*