import java.util.Scanner;
public class Pattern11
{
public static void main(String[] args)
{
//ASCII code of 'A'
int alphabet=65;
// create class.
Scanner sc = new Scanner(System.in);
// enter rows here.
System.out.print("Enter number of rows: ");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
// will print numbers ladder in different way.
for(int i=1;i<rows;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print((char)alphabet);
alphabet++;
}
System.out.println();
}
sc.close();
}
}
Output
First run:
Enter number of rows: 10
Here is your pattern....!!!
A
BC
DEF
GHIJ
KLMNO
PQRSTU
VWXYZ[\
]^_`abcd
efghijklm
Second run:
Enter number of rows: 5
Here is your pattern....!!!
A
BC
DEF
GHIJ
Print pattern of alphabets in java
Output
need an explanation for this answer? contact us directly to get an explanation for this answer