Can anyone tell me how the following sequence can be printed in java or c?
*_________*
**______**
***___***
********
*_________*
**______**
***___***
********
outermost loop(no. of lines)
{
loop1() //prints 1st set of stars
{}
loop2() //prints set of spaces
{}
loop3() //prints 2nd set of stars
{}
}
public class pyramid {
public static void DesignPattern (int row){
int i,j;
for (i = 0; i <= row ;i++){
for (j = 0 ;j<=i; j++){
System.out.print("*");
}
for(j=0; j <=(row-i-1)*2 ;j++){
System.out.print("__");
}
for (j=0; j<=i;j++){
System.out.print("*");
}
System.out.println();
}
}
public static void main (String[] args){
DesignPattern(3);
}
}