#include using namespace std;int main(){ int arr1[10][10],arr2[10][10]; int result[10][10]; int row,column; int i,j; cout<"--------matrix>"--------matrix> //ask user to enter the number of row and column cout<"enter the="" number="" of="" rows="" :="">"enter> cin>>row; cout<"enter the="" number="" of="" columns="" :="">"enter> cin>>column; // asking user to enter the data on matrix cout<"\nenter the="" data="" for="" 1st="" matrix="" :="">"\nenter> for (i=0; i { for (j=0; j { cout<"data>"data><> cin>>arr1[i][j]; } } cout<"\nenter the="" data="" for="" second="" matrix="" :="">"\nenter> for (i=0; i { for (j=0; j { cout<"data>"data><> cin>>arr2[i][j]; } } // display matrix cout<"\n1st matrix="" \n="">"\n1st> for (i=0; i { for (j=0; j { cout<">"><> } cout<> } cout<"\n2nd matrix="" \n="">"\n2nd> for (i=0; i { for (j=0; j<> { cout<">"><> } cout<> } cout<"\nresult matrix="">"\nresult> int k=0; for(i=0;i< row;i++)=""> { for(j=0;j<> { result[i][j] = 0; for(k=0;k<> { result[i][j] = result[i][j] + arr1[i][k] * arr2[k][j]; } } // end of j loop } // end of i loop // displays the result for (i=0; i { for (j=0; j { cout<><">"> } cout<"\n>"\n> } return 0;}wherefirst matrix are 2,4,6,8 and second matrix are 1,3,5,7,9..The questionexplain the programming in detailsand explain theproblem statementand giva aconclution ....
using namespace std;
int main(){ int arr1[10][10],arr2[10][10]; int result[10][10]; int row,column; int i,j; cout<"--------matrix>"--------matrix> //ask user to enter the number of row and column cout<"enter the="" number="" of="" rows="" :="">"enter> cin>>row; cout<"enter the="" number="" of="" columns="" :="">"enter> cin>>column; // asking user to enter the data on matrix cout<"\nenter the="" data="" for="" 1st="" matrix="" :="">"\nenter> for (i=0; i { for (j=0; j { cout<"data>"data><> cin>>arr1[i][j]; } }
cout<"\nenter the="" data="" for="" second="" matrix="" :="">"\nenter> for (i=0; i { for (j=0; j { cout<"data>"data><> cin>>arr2[i][j]; } }
// display matrix
cout<"\n1st matrix="" \n="">"\n1st> for (i=0; i { for (j=0; j { cout<">"><> } cout<> }
cout<"\n2nd matrix="" \n="">"\n2nd> for (i=0; i { for (j=0; j<> { cout<">"><> } cout<> } cout<"\nresult matrix="">"\nresult> int k=0; for(i=0;i< row;i++)=""> { for(j=0;j<> { result[i][j] = 0; for(k=0;k<> { result[i][j] = result[i][j] + arr1[i][k] * arr2[k][j]; } } // end of j loop } // end of i loop
// displays the result
for (i=0; i { for (j=0; j { cout<><">"> } cout<"\n>"\n> } return 0;
}
where
first matrix are 2,4,6,8 and second matrix are 1,3,5,7,9..
The questionexplain the programming in detailsand explain theproblem statementand giva aconclution ....
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here