Computer Science, asked by tewariprema9, 8 months ago

write a program in java to print the following pattern
B
BL
BLU
BLUE
BLUEJ​

Answers

Answered by Anonymous
6

Answer:

public class pattern

{

public static void main (String args[ ])

{

String s ="BLUEJ";

int a, l;

l=s.length();

int(a=1;a<=l;a++)

{

System.out.println(s.substring(0,a));

}

}

}

Answered by atrs7391
0

class test

{

   public static void main (String[] args)

   {

       String s ="BLUEJ";

       int l=s.length();

       int a;

       for (a=1; a<=l; a++)

       {

           System.out.println(s.substring(0,a));

       }

   }

}

Similar questions