Matriks 1

 Matriks


#include<iostream>

using namespace std;

//kamus

int a[5]= {3,4,1,2,4};

int b[5]={8,7,2,2,5};

int c,x;

//deskripsi

int main()

{

    cout << "Penjumlahan Matriks Ordo 1X4" << endl;

    cout << "C = A+B" << endl << endl;



    cout << "A = { " ;

    x=0;

    do

    {

        cout << a[x] << " " ;

        x=x+1;

    }while(x<=4);

    cout << "}" << endl ;



    cout << "B = { " ;

    x=0;

    do

    {

        cout << b[x] << " " ;

        x=x+1;

    }while(x<=4);

    cout << "}" << endl ;



    cout << "C = { " ;

    x=0;

    do

    {

        c = a[x]+b[x];

        cout << c << " " ;

        x=x+1;

    }while(x<=4);

    cout << "}" << endl ;



return 0;

}


Komentar

Postingan Populer