Computer Science, asked by annasonnet1, 7 months ago

write a program to display the given pattern.
BLUEJ
BLUE
BLU
BL
B​

Answers

Answered by 11a31JoanneTom
2

Answer:

Explanation:

String str="BLUEJ";

int i,j;

char c;

for(i=5-1;i>=0;i--)

{  

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

{

     c=charAt(j);

     System.out.print(c+" ");  

 }

System.out.println();

}

}

}

Answered by atrs7391
0

class test

{

   public static void main (String[] args)

   {

       String s ="BLUEJ";

       int l=s.length();

       int a;

       for (a=l; a>=1; a--)

       {

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

       }

   }

}

Similar questions