hexwolfman

Untitled

Jul 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. //Hector Villalobos
  2. //PROGRAMMING I M-F 11am
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Challenge20SquareDisplay {
  7.   public static void main(String[] args) {
  8.    
  9.     Scanner keyboard = new Scanner(System.in);
  10.    
  11.     System.out.print("Enter a positive integer no greater than 15: ");
  12.     int input = keyboard.nextInt();
  13.    
  14.     while(input > 15) {
  15.       System.out.print("Invalid integer. Try Again: ");
  16.       input = keyboard.nextInt();
  17.     }
  18.    
  19.     for(int i = 1; i <= input; i++) {
  20.       for(int j = 1; j <= input; j++)
  21.         System.out.print("X");
  22.       System.out.println();      
  23.     }  
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment