WELCOME TO MY BLOG "AGSYNI" ^-^ "#*JGN LUPA KOMENNYA SOB*#"

Selasa, 07 Juni 2011

java HIPHipHura

<blink>Nb :edit buat tampilannya agak laen jgn cuman copiy paste</blink>
import javax.swing.*;
public class HipHura
{
    public static void main (String[] args)
    {
    float i,j,n;
   
    System.out.println("\tMencetah Hip-Hip Hura");
    System.out.println("==============================================");
    String batas = JOptionPane.showInputDialog("Masukkan Batas cetak : ");
    System.out.println("Berapa kali    : "+ batas);
    n = Float.parseFloat(batas);

    for (i = 1; i<= n ; i++)
        {
           for(j= 1 ; j<= i; j++)
           {

           if ( i >= 2 && j >= 2 &&  i==j  )
        {System.out.print(" hura");}
        else
        {System.out.print(" hip"); }
         
        }
   
    System.out.println();
        }

}
}

output :

Tidak ada komentar:

Posting Komentar

#navbar-iframe { opacity:0.0; filter:alpha; (Opacity=0)} #navbar-iframe:hover { opacity:1.0; filter:alpha; (Opacity=0, FinishedOpacity=100)}