import java.util.*;
class pat22
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int i,j;
System.out.print("\n\n\tEnter number of line to print: ");
int n=sc.nextInt();
System.out.println("------pattern is------ ");
for(i=0;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(" ");
}
for(j=1;j<=n-i;j++)
{
System.out.print("* ");
}
System.out.println();
}
}
}
No comments:
Post a Comment