rumus: panjang * lebar
Program java :
import javax.swing.JOptionPane;
public class persegipanjang
{
public static void main(String args[])
{
String first;String second;String three;int number1;int number2; int sum;
first=JOptionPane.showInputDialog("Masukkan panjang :");
second=JOptionPane.showInputDialog("Masukkan lebar :");
number1=Integer.parseInt(first);
number2=Integer.parseInt(second);
sum=number1*number2;
JOptionPane.showMessageDialog(null,"Luas persegi panjang adalah : "+sum,"Hasil",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
Program java :
import javax.swing.JOptionPane;
public class persegipanjang
{
public static void main(String args[])
{
String first;String second;String three;int number1;int number2; int sum;
first=JOptionPane.showInputDialog("Masukkan panjang :");
second=JOptionPane.showInputDialog("Masukkan lebar :");
number1=Integer.parseInt(first);
number2=Integer.parseInt(second);
sum=number1*number2;
JOptionPane.showMessageDialog(null,"Luas persegi panjang adalah : "+sum,"Hasil",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
0Awesome Comments!