solid rectangle with capital alphabet pattern 1 in java.

import java.util.*;
class Pattern {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        System.out.println("enter the n and m=");
        int n=sc.nextInt();
        int m=sc.nextInt();
        for(int i=1; i<=n; i++){
            for(int j=1; j<= m; j++){
                System.out.print((char)(i+64)+" ");
            }
            System.out.println();
        }
    }
}

output ->

 enter the n and m=
5
7
A A A A A A A 
B B B B B B B 
C C C C C C C 
D D D D D D D 
E E E E E E E  
              
                      


Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.