TO PRINT PATTERN TYPE 20
A1
AB12
ABC123
ABCD1234
AB12
ABC123
ABCD1234
class Pattern20
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++)
{ char x='A';
int k=1;
for(int j=1;j<=8;j++)
{
if(j>=5-i && j<=4+i)
{
if(j<=4)
{
System.out.print(x);
x++;
}
else
{
System.out.print(k);
k++;
}
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
Comments
Post a Comment