Selasa, 12 April 2011

program invers pada JAVA

Berikut adalah code Membuat invers pada JAVA

import javax.swing.*;
class invers
{
public static void main(String[] args)
{
int i;
int j;
int x = Integer.parseInt(JOptionPane.showInputDialog ("Jumlah anggota A"));
int [] a = new int [x];
int y = Integer.parseInt(JOptionPane.showInputDialog ("Jumlah anggota B"));
int [] b = new int [y];
for (i=0 ; i
{
int c = Integer.parseInt (JOptionPane.showInputDialog ("elemen A ke" + (i+1)));
a[i] = c;
}
for (j=0 ; j
{
int d = Integer.parseInt (JOptionPane.showInputDialog ("elemen B ke" + (j+1)));
b[j] = d;
}
for (i=0 ; i
{
for (j=0 ; j
{
System.out.println("{" + b[j] + "," + a[i] + "}");
}
}
}

Tidak ada komentar:

Posting Komentar