// Sample program that produces a diamond as output. public class Diamond1 { public static void main(String[] args) { for (int row = 1; row <= 3; row++) { for (int space = 1; space <= 3 - row; space++) { System.out.print(" "); } System.out.print("/"); for (int dot = 1; dot <= 2 * row - 2; dot++) { System.out.print("."); } System.out.println("\\"); } for (int row = 3; row >= 1; row--) { for (int space = 1; space <= 3 - row; space++) { System.out.print(" "); } System.out.print("\\"); for (int dot = 1; dot <= 2 * row - 2; dot++) { System.out.print("."); } System.out.println("/"); } } }