class
Main
{
public
static void main(String args[])
{
int
i,j;
for(i=1;i<=10;i++)
{
for(j=1;j<=10-i;j++)
{
System.out.print(" ");
}
char c
= 'A';
for(j=1;j<=i;j++)
{
System.out.print("
"+c);
c++;
}
--c;
char p
= --c;;
for(j=2;j<=i;j++)
{
System.out.print("
"+p);
p--;
}
System.out.println();
}
}
}
OUTPUT:-
C:\Users\Satyendra\Desktop>javac
Main.java
C:\Users\Satyendra\Desktop>java
Main
A
A
B A
A
B C B A
A B C D
C B A
A B C D E D C B A
A B
C D E F E D C B A
A B C D E F G F E D C B A
A B C
D E F G H G F E D C B A
A B C D E F G H I H G F E D C B A
A B C
D E F G H I J I H G F E D C B A