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