Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package quadradooco;
- /**
- *
- * @author Michel
- */
- import java.util.Scanner;
- public class QuadradoOco {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner input = new Scanner(System.in);
- System.out.println("Input square length in UNITS");
- int length = input.nextInt();
- if (length < 0) {
- length *= -1;
- }
- int i = 1,
- f = 1;
- while ( i <= length ) {
- f = 1;
- while (f <= length) {
- if ( i == 1 || i == length || f == length || f == 1 ) {
- System.out.print("#");
- f++;
- }
- else {
- System.out.print(" ");
- f++;
- }
- }
- System.out.print("\n");
- i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement