A
A B
A B C
A B C D
A B C
A B
A
This is the output
class ABCD
{
public static void main(String a[])
{
char c;
for(int i=1;i<=7;i++)
{
int x = 65;
if(i<5)
{
for(int j = 4 ; j>=i;j--)
{
System.out.print(" ");
}
for(int k=1;k<=i;k++)
{
c=(char)x;
System.out.print(c + " " );
x=x+1;
}
}
else
{
for(int j=4;j<=i;j++)
{
System.out.print(" ");
}
for(int j=7;j>=i;j--)
{
c=(char)x;
System.out.print(c + " ");
x = x + 1;
}
}
System.out.println();
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment