Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/07/2015, 15:46
ougalejo
 
Fecha de Ingreso: julio-2015
Mensajes: 10
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Dibujar con asteriscos

Código:
public static void funcion(int n) {
        for (int j = 1; j <= n; ++j) {
            for (int i = 1; i <= n; ++i) {
                if(j==1 || j==n){
                    System.out.print("*");
                }else{
                    System.out.print("*");
                    break;//para que termine el for
                }
            }
            System.out.println();
        }
    }