Perkalian Java


import javax.swing.*;

public class Perkalian
{
public static void main (String [] args)
{
int x;
int y;
int sum;
int i;
y = 1;
sum = 0;

x = Integer.parseInt(JOptionPane.showInputDialog(null,”bilangan pertama :”));
y = Integer.parseInt(JOptionPane.showInputDialog(null,”bilangan kedua :”));

for (i=1;i<=y;i++) {
sum = sum + x;
}
JOptionPane.showMessageDialog(null,x+ “x” +y+ “=” +sum);
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s