Java program to print the following pattern on the console12344321 123**321 12****21 1******1 Algorithm:- STEP 1: START
- STEP 2: SET lines=4
- STEP 3: DEFINE i, j.
- STEP 4: SET space=0
- STEP 5: SET i=0
- STEP 6: REPEAT STEP 7 TO 20 UNTIL i
- STEP 7: SET j=1
- STEP 8: REPEAT STEP 9 UNTIL j <= space.
- STEP 9: PRINT " " and SET J=J+1
- STEP 10: SET j=1
- STEP 11: REPEAT STEP 12 and 13 UNTIL j<=lines
- STEP 12: IF j <=(lines-i). PRINT j ELSE PRINT *
- STEP 13: SET j=j+1
- STEP 14: DECREMENT j by 1
- STEP 15: REPEAT STEP 16 and 17 UNTIL j>0
- STEP 16: IF j>( lines-i ) then PRINT * ELSE PRINT j
- STEP 17: SET j=j-1
- STEP 18: IF (lines-i) >9 INCREMENT space by 1
- STEP 19: PRINT new line
- STEP 20: SET i=i+1
- STEP 21: END
Program:Output: 12344321
123**321
12****21
1******1
|