Write a program to print the following pattern on the console.12344321 123**321 12****21 1******1 Algorithm- STEP 1: START
- STEP 2: SET lines=15
- STEP 3: Initialize i,j,k,and l
- STEP 4: SET space=0
- STEP 5: SET i=1
- STEP 6: REPEAT STEP 7 TO 20 UNTIL i is less than lines
- STEP 7: SET j=1
- STEP 8: REPEAT STEP 9 UNTIL j is less than or equals to space.
- STEP 9: PRINT " " and SET J=J+1
- STEP 10: SET j=1
- STEP 11: REPEAT STEP 12 and 13 UNTIL j is less than or equals to lines
- STEP 12: IF j is less than equals 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 is greater than 0
- STEP 16: IF j is greater than lines-i PRINT * ELSE PRINT j
- STEP 17: SET j=j-1
- STEP 18: IF lines-i is greater than 9 INCREMENT space by 1
- STEP 19: PRINT new line
- STEP 20: SET i=i+1
- STEP 21: EXIT
Solution:C Program:Output: PHP Program:Output: Java Program:Output: C# Program:Output: Python Program:Output:
|