Coding 2
9/21/2011 02:10:00 PMimport javax.swing.JOptionPane;
public class coding2 {
public static void main(String args[])
{
String N, Message, I;
int n = 0, i, nr;
I = JOptionPane.showInputDialog("Berapakah banyak data yang ingin anda inputkan?");
i = Integer.parseInt(I);
for (int X = 1; X <= i; X++)
{
N = "";
N = JOptionPane.showInputDialog("Masukkan Nilai " + X);
n = n + Integer.parseInt(N);
}
nr = n / i;
if (nr >= 60)
{
message = "Nilai anda " + nr;
}
else
{
message = "Nilai anda " + nr;
}
JOptionPane.showMessageDialog(null, message);
}
}
BERIKUT INI HASILNYA :
0 comments