31 Mar 2011

program 3

prgogram ini menghasilkan output karakter membentuk huruf dgn method

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



package hurufm;

/**
 *
 * @author User
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        for (int garis = 1; garis<= 4;garis++){
            System.out.print ("|");
            for(int spasi = 1; spasi<= garis*-2+8; spasi++){
                System.out.print (" ");
            }
            System.out.print ("!");
            for (int min = 1; min <= garis * 4-4; min++){
                System.out.print ("-");
            }
                System.out.print ("!");
            for(int spasi=1;spasi<= garis*-2+8; spasi++){
                System.out.print (" ");
            }
                System.out.println ("|");
            }

        }
    }

0 comments:

Posting Komentar