Sabtu, 29 Desember 2012

PENJUMLAHAN MATRIX 2X2

 
 
    #include <iostream.h>
    #include <conio.h>

    main()
    {
        int matA[2][2], matB[2][2], matC[2][2];
    cout<<"PROGRAM PENJUMLAHAN MATRIKS ORDO 2x2"<<endl;
    cout<<"====================================="<<endl;
    cout<<endl;
    cout<<"Matriks A"<<endl;
    cout<<endl;
        for(int i=0; i<2; i++)
        {
            for(int h=0; h<2; h++)
            {
                cout<<"Data Matriks A ["<<i<<"] ["<<h<<"] : ";
                cin>>matA[i][h];
            }

        }
        endl(cout);
     cout<<"Matriks B"<<endl;
     cout<<endl;
        for(int i=0; i<2; i++)
        {
            for(int h=0; h<2; h++)
            {
                cout<<"Data Matriks B ["<<i<<"] ["<<h<<"] : ";
                cin>>matB[i][h];
            }

        }
        endl(cout);


        cout<<"Matriks A + Matriks B :"<<endl;
        for(int i=0; i<2; i++)
        {
            for(int h=0; h<2; h++)
            {
                matC[i][h] = matA[i][h]+matB[i][h];
                cout<<"  "<<matC[i][h];

            }
            cout<<endl;
        }
    cout<<endl;
    cout<<endl;
    cout<<"kelompok 3"<<endl;
     getch();
    }