MATRIKS TRANSPOSE(JAVA)

import jeliot.io.*;

public class transpose{
 public static void main(String[] args){
   int n,m;
   int A[][];
   A = new int[10][10];
   int B[][];
   B = new int[10][10];
     System.out.println("Masukkan banyak baris :");
      n = Input.readInt();
     System.out.println("Masukkan banyak kolom :");
      m = Input.readInt();
    
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
         System.out.println("Masukkan baris ke-" + i+1 +"kolom ke-" + j+1 + ":");
          A[i][j] = Input.readInt();
            }
          }

    System.out.println("\nMatriks\n");
     for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
        System.out.println(A[i][j] + " ");
              }
        System.out.println("\n");
           }
     
    System.out.println("\nMatriks setelah di transpose\n");
      for(int i=0; i<m; i++){
            for(int j=0; j<n; j++){
               System.out.println(A[j][i] + " ");
                }
         System.out.println("\n");
          }
       }
     }
Iklan

One comment on “MATRIKS TRANSPOSE(JAVA)

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s