Write a Java program that produces the following output. Use nested for loops to capture the structure of the figure.(See also Self-Check Problems 29 and 30.)
!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!!!!!!//
\\\\!!!!!!!!!!!!!!////
\\\\\\!!!!!!!!!!//////
\\\\\\\\!!!!!!////////
\\\\\\\\\\!!//////////
Program:
public class Ch02Ex16
{
public static void main(String[] args)
{
for (int i = 1; i <= 6; i++)
{
for (int j = 1; j <= 2 * i - 2; j++)
{
System.out.print("\\");
}
for (int j = 1; j <= 26 - 4 * i; j++)
{
System.out.print("!");
}
for (int j = 1; j <= 2 * i - 2; j++)
{
System.out.print("/");
}
System.out.println();
}
}
}
Output: