Rabu, 06 Juni 2012

Mentranspose Array dalam Java Menggunakan Inputan User :


import javax.swing.JOptionPane;
/**
 *
 * @author ika
 */
public class Array {
    public static void main (String []args){
        int bmt1=Integer.parseInt(JOptionPane.showInputDialog("Masukkak baris"));
        int kmt1=Integer.parseInt(JOptionPane.showInputDialog("Masukkak Kolom"));
        int matrik1[][]=new int [bmt1][kmt1];
          for(int i=0; i
            for (int j=0 ;j
       matrik1[i][j]=Integer.parseInt(JOptionPane.showInputDialog("[matrik1]\n Baris ke-"+i+" Kolom ke-"+j));
             }
            System.out.println("Matrik Sebelum Transpose");
             for(int i=0; i
                for (int j=0 ;j
                   System.out.print(" "+matrik1[i][j]);
                           System.out.println();
             }
             System.out.println("Matrik Sesudah Transpose");
             for(int i=0; i
                for (int j=0 ;j
                   System.out.print(" "+matrik1[j][i]);
                           System.out.println();
             }
    }
}

0 komentar:

Posting Komentar

TOP ENTRY