Answer:
import java.util.Scanner;
class SquareDisplay {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter an integer in the range of 1-15: ");
int num = scan.nextInt();
if ((num > 0) && (num <= 15)) {
String s = "X".repeat(num) + "\\";
System.out.print(s.repeat(num));
} else {
// your error handling
}
scan.close();
}
}
Step-by-step explanation: