write a program to display the given pattern.
BLUEJ
BLUE
BLU
BL
B
Answers
Answered by
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
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
Environmental Sciences,
3 months ago
Science,
3 months ago
English,
7 months ago
English,
7 months ago