C++ one dimensional array that add sum of two array - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Monday, October 14, 2019

C++ one dimensional array that add sum of two array

C++ one dimensional array that add sum of two array 




#include <iostream>

using namespace std;

int main()
{
    int a[50],b[50],c[50];
    int c1,r1,i;
    cout<< "Enter the number of columns : ";
    cin>>c1;
    cout<< "Enter the number of rows : ";
    cin>>r1;
    cout<< "Enter the element of of First Array : "<<endl;
    for(i=0;i<c1;i++){
        cin>>a[i];

    }
    cout<< "Enter the element of of Second Array : "<<endl;
    for(i=0;i<r1;i++){
        cin>>b[i];

    }
    cout<< "The sum of two Matrices are : "<<endl;
    for (i=0;i<c1;i++){
        c[i]=a[i]+b[i];

    cout<<a[i]<< " + "<<b[i]<< " = "<<c[i]<<endl;
    }

    return 0;
}

No comments:

Post a Comment

ads1

Post Top Ad