Write a program to print the following Pattern.

 THE FOLLOWING PROGRAM SEGMENT SHOWS HOW TO PRINT THE FOLLOWING PATTERN.

A B C D E

A B C D

A B C

A B 

import java.util.*;

class pattern

{

    public static void main (String args[])

    {

       Scanner ob = new Scanner (System.in);

 System.out.println("The pattern is");


for(char i = 'E'; i >= 'A' ; i--)

{

 for(char j = 'A' ; j <= i; j++)

 {

      System.out.print(j);

    }

     System.out.println();

    }

    }

}

    The above program is compiled and is without any error.

Hope you guys found it helpful.

Please share it with your friends and comment down in the comment section below.

Follow https://askrisfor.blogspot.com/ for more such updates.

Visit us again.

Thank you!!

Comments

Popular Posts