Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/12/2016, 22:56
Avatar de detective_jd
detective_jd
 
Fecha de Ingreso: abril-2011
Ubicación: Salto
Mensajes: 437
Antigüedad: 13 años
Puntos: 6
Respuesta: Duda de como hacer un rectangulo en Java

Hola, aquí tienes algo de lo que te servir:

Código Java:
Ver original
  1. int ancho = Integer.parseInt("JOptionPane.showInputDi... el ancho"));
  2. int largo = Integer.parseInt("JOptionPane.showInputDi... el largo"));
  3.  
  4. for(int a = 0; a < ancho; a++)
  5. {
  6. for(int l = 0; l < largo; l++)
  7. {
  8. if( l == 0)
  9. {
  10. System.out.println("*");
  11.  
  12. }
  13. else
  14. {
  15. System.out.print("*");
  16.  
  17. }
  18. }
  19. }