Javatpoint Logo
Javatpoint Logo

Java program to print the following pattern on the console

A
B B
C C C
D D D D
E E E E E

To accomplish this task, we need to use two loops, the first loop is responsible for printing the line breaks whereas the second loop is responsible for printing the alphabet.

Algorithm:

  • STEP 1: START
  • STEP 2: SET n=4.
  • STEP 3: SET i=0.
  • STEP 4: REPEAT STEP 5 to STEP 7 UNTIL i<=n
  • STEP 5: SET j = 0. REPEAT STEP 6 UNTIL j<=i.
  • STEP 6: PRINT char(65+i) and SET j=j+1.
  • STEP 7: PRINT new line and SET i=i+1.
  • STEP 8: END

Program:

Output:

A
B B
C C C
D D D D
E E E E E
Next TopicJava Programs





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA