Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner teclado = new Scanner(System.in);
- System.out.println("Introduce el tamaño del cuadrado: ");
- int n = teclado.nextInt();
- if(n >= 0 )
- { //linea superior
- for(int i = 0; i < n; i++);
- {
- System.out.println("*");
- }
- System.out.println();
- //centro
- for(int i=0; i<n-2; i++);
- {
- System.out.println("*");
- for(int j = 0; j < n-2; j++)
- {
- System.out.println(" ");
- }
- System.out.println("*");
- }
- //linea inferior
- for(int i = 0; i < n; i++);
- {
- System.out.println("*");
- }
- }
- else
- {
- System.out.println("tampoco te flipes y mete un numero positivo");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement