Javatpoint Logo
Javatpoint Logo

Java program to print the following pattern

5432*
543*1
54*21
5*321
*4321

Algorithm:

  • STEP 1: START
  • STEP 2: DEFINE i, j.
  • STEP 3: SET lines=5
  • STEP 4: SET i=1. REPEAT STEP 5 to STEP 10 UNTIL i <= lines
  • STEP 5: SET j=lines
  • STEP 6: REPEAT STEP 7 and 8 UNTIL j >= 1
  • STEP 7: IF j!=i then PRINT j
                    else PRINT *
  • STEP 8: j=j-1
  • STEP 9: PRINT new line.
  • STEP 10: i=i+1
  • STEP 11: END

Program:

Output:

5432*
543*1
54*21
5*321
*4321
Next TopicJava Programs




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA