WRITE A JAVA PROGRAM TO BELOW PATTERN:
A B C D
E F G
H I
J
Answers
Answered by
1
Answer:
for(i=1; i<=rows; i++){
for(j=i; j<=rows; j++){
System.out.print((char)(j+letter));
}
Explanation:
import java.util.Scanner;
class AlphabetStarPattren{
public static void main (String args[]){
int i,j;
int letter=10;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows to print: ");
int rows=scan.nextInt();
for(i=1; i<=rows; i++){
for(j=i; j<=rows; j++){
System.out.print((char)(j+letter));
}
System.out.println();
}
}
}
Similar questions