www.HyperSmash.com
Search Engine

Piramida Terbalik JOptionPane

nah ni bagi yang butuh script soft code piaramida terbalik...
langsung zzzzz...

package alifan_1110651244;

import javax.swing.JOptionPane;

class piramid_terbalik
{
    public static void main(String[] args)
    {
int baris = Integer.parseInt (JOptionPane.showInputDialog
                        ("masukkan jumlah baris :"));
String a = "";

for (int i=baris; i>0; i--)
{
for (int j=0; j<baris-i; j++)
a += "  ";
for (int j=0; j<2*i-1; j++)
a += "* ";
a += "\n";
}
JOptionPane.showMessageDialog (null, "Baris = " + baris + "\n\n" + a);
System.exit(0);
    }
}


outputnya akan seperti ini




semoga bermanfaat ......semangat



Share
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 komentar: