/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package seudocodigo11bis;
import java.util.Scanner;
/**
 *
 * @author juan
 */
public class Seudocodigo11bis {
    /**
     * @param args the command line arguments
     */
 
   public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);
        int largo,alto;
  
        System.out.println("Introduzca el largo");
        largo=entrada.nextInt();
        System.out.println("Introduzca el alto");
        alto=entrada.nextInt();
        for (int i = 1; i <= alto; i++) {
            //Imprimo la primera y la última línea de asteriscos
            if ((i==1)||(i==alto)) 
            {
                for (int j = 1; j <= largo; j++) {
                    System.out.print("*");
                }
            }
            else
             //Imprimimos un asterisco-espacios en blanco-asterisco   
            {
                System.out.print("*");
                for (int j = 1; j <= (largo-2); j++) {
                    System.out.print(" ");
                }
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
 
 
 
                                        
                                    
 
  
 
 
 
 
 
 
 
 
 
 
 
No hay comentarios:
Publicar un comentario