Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PatternOne{
- public static void main(String args[]){
- int n = 5; // Number of Rows
- for(int i = 1; i <= n; i++){
- int j; char ch = 'A';
- for(j = 2*(n-i); j > 0; j--) // For Spaces
- System.out.print(" ");
- for(j = i; j > 0; j--) // For Numbers
- System.out.print(j + " ");
- for(j = i + 1; j > 2; j--) // For Alphabets
- System.out.print(ch++ + " ");
- System.out.println();
- }
- }
- }
- //Output:-
- // 1
- // 2 1 A
- // 3 2 1 A B
- // 4 3 2 1 A B C
- //5 4 3 2 1 A B C D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement