Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PatternDemo
- {
- public static void main(String...args)
- {
- char charUptoYouHaveToPrint='G';
- int i,j,a,top=charUptoYouHaveToPrint-64,topp;
- topp=top-1;
- for (i=0;i<=top+1;i++)
- {
- a='A'-1;
- for (j=0;j<top;j++)
- {
- a++;
- if (j>topp-i)
- System.out.print (" ");
- else
- System.out.print((char)(a));
- }
- a--;
- for (j=0;j<topp;j++)
- {
- if (j<(i-1))
- System.out.print(" ");
- else
- System.out.print((char)(a));
- a--;
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement