Computer Science, asked by ponnu27, 11 months ago

aaaa bbbb AAAA BBBB pattern program in java ​

Answers

Answered by duragpalsingh
2

The java program for the following pattern is as follows:

class Pattern

{

   public static void main(String args[]) {

       int x = 97;

       for (int a = 1; a<= 4; a++) {

           for (int b = 1; b <= 4; b++) {

               System.out.print((char)x + " ");

           }

           x++;

           if (a == 2)

               x = 65;

           System.out.println();

       }

   }

}

Output:

aaaa

bbbb

AAAA

BBBB

Explanation:

Refer to the attachment:

Line 4: Initializing x = 97 to convert it into lower case character.

Line 5: Loop 1 for columns

Line 6: Loop 2 for rows

Line 7 : Converting into char and printing.

Line 10, 11: Chainging lowercase to uppercase as x = 65 will be A as per ASCII rules.

Attachments:
Answered by farhaanshenmortal132
1

Answer:

GJTNJ

Explanation:

Similar questions