Java Matriks

public class Matriks{
public static void main (String [] args ){
    int a=2;
    int b=4;
    int c=5;
    int d=2;
    int p=3;
    int q=8;
    int r=6;
    int s=1;
    System.out.println("Matriks A");
    System.out.println(a + " " + b);
    System.out.println(c + " " + d);
    System.out.println("Matriks B");
    System.out.println(p + " " + q);
    System.out.println(r + " " + s);

    int t,u,v,w,y;

    t=a*p+b*r;
    u=c*p+d*r;
    v=a*q+b*s;
    w=c*q+d*s;

    System.out.println ("Perkalian Matriks");
    System.out.println("Matriks AxB = ");
    System.out.println(t + " " + v);
    System.out.println(c + "  " + w);
    t=a+p;
    u=b+q;
    v=c+r;
    w=d+s;
    System.out.println("Penjumlahan Matriks ");
    System.out.println("Matriks A+B = ");
    System.out.println(t + " " + u);
    System.out.println(v + " " + w);

    t=a-p;
    u=b-q;
    v=c-r;
    w=d-s;
    System.out.println("Pengurangan Matriks ");
    System.out.println("Matriks A-B = ");
    System.out.println(t + " " + u);
    System.out.println(v + "  " + w);
}
}

0 Response to "Java Matriks"

Posting Komentar