Write a program to print the following Pattern.

 THE FOLLOWING PROGRAM SEGMENT SHOWS HOW TO PRINT THE FOLLOWING PATTERN AS PER USER'S CHOICE AND MANY OTHER PATTERNS.

B

B L

B L U

B L U E

import java.util.*;

class pattern1

{

    public static void main (String args[])

    {

       Scanner ob = new Scanner (System.in);

 System.out.println("Enter the word to make a pattern of ");

String s = ob.nextLine();

for(int i = 0; i < s.length() ; i++)

{

 for(int  j = 0; j <= i; j++)

 {

      System.out.print(s.charAt(i));

    }

     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