Write a program on the pattern given below;
B
BL
BLU
BLUE
BLUEJ
Answers
Answered by
1
Answer:
Explanation:
void main(){
char s="BLUEJ";
for(int i=0;i<5;i++)
{
for(int j=0;j<=i;j++)
printf("%c",s[j]);
}
printf("\n");
}
Answered by
2
class test
{
public static void main (String[] args)
{
String s ="BLUE";
int l=s.length();
int a;
for (a=1; a<=l; a++)
{
System.out.println(s.substring(0,a));
}
}
}
Similar questions