Write a Java program to print repeated character pattern or alphabets in each row pattern using for loop.
package Alphabets;
import java.util.Scanner;
public class RepeatedCharPat1 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Repeated Character Pattern Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Repeated Character/Alphabets Pattern");
int alphabet = 65;
for (int i = 0 ; i < rows; i++ )
{
for (int j = 0 ; j <= i; j++ )
{
System.out.print((char)alphabet + " ");
}
alphabet++;
System.out.println();
}
}
}

This example program displays the right triangle pattern of repeated characters in each row using a while loop.
package Alphabets;
import java.util.Scanner;
public class RepeatedCharPat2 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Repeated Character Pattern Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Repeated Character/Alphabets Pattern");
int i = 0, j, alphabet = 65;
while(i < rows )
{
j = 0 ;
while( j <= i )
{
System.out.print((char)alphabet + " ");
j++;
}
alphabet++;
System.out.println();
i++;
}
}
}
Enter Repeated Character Pattern Rows = 8
Printing Repeated Character/Alphabets Pattern
A
B B
C C C
D D D D
E E E E E
F F F F F F
G G G G G G G
H H H H H H H H
The below shown program will print the repeated characters or alphabets pattern using do while loop.
package Alphabets;
import java.util.Scanner;
public class RepeatedCharPat3 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Repeated Character/Alphabets Pattern");
int i = 0, j, alphabet = 65;
do
{
j = 0 ;
do
{
System.out.print((char)alphabet + " ");
} while( ++j <= i ) ;
alphabet++;
System.out.println();
} while(++i < rows );
}
}
Enter Rows = 12
Printing Repeated Character/Alphabets Pattern
A
B B
C C C
D D D D
E E E E E
F F F F F F
G G G G G G G
H H H H H H H H
I I I I I I I I I
J J J J J J J J J J
K K K K K K K K K K K
L L L L L L L L L L L L