TO PRINT PATTERN TYPE 22
1
12A
123AB
1234ABC
12A
123AB
1234ABC
class Pattern22
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++)
{ int x=1;
char y='A';
for(int j=1;j<=7;j++)
{
if(j>=5-i && j<=3+i)
{ if(j<=4)
{
System.out.print(x);
x++;
}
else
{
System.out.print(y);
y++;
}
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
Comments
Post a Comment