Advertisement
Shailrshah

Retarded Pattern

Sep 23rd, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. class PatternOne{
  2.     public static void main(String args[]){
  3.        
  4.         int n = 5; // Number of Rows
  5.         for(int i = 1; i <= n; i++){
  6.             int j; char ch = 'A';
  7.             for(j = 2*(n-i); j > 0; j--) // For Spaces
  8.                 System.out.print(" ");
  9.             for(j = i; j > 0; j--) // For Numbers
  10.                 System.out.print(j + " ");
  11.             for(j = i + 1; j > 2; j--) // For Alphabets
  12.                 System.out.print(ch++ + " ");
  13.             System.out.println();
  14.         }
  15.     }
  16. }
  17. //Output:-
  18. //        1
  19. //      2 1 A
  20. //    3 2 1 A B
  21. //  4 3 2 1 A B C
  22. //5 4 3 2 1 A B C D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement