logo

C의 행렬 곱셈

행렬 곱셈 C에서는 2개의 행렬을 더하고, 빼고, 곱하고 나눌 수 있습니다. 이를 위해 행 번호, 열 번호, 첫 번째 행렬 요소 및 두 번째 행렬 요소에 대해 사용자로부터 입력을 받습니다. 그런 다음 사용자가 입력한 행렬에 대해 곱셈을 수행합니다.

무어 기계의 예

행렬 곱셈에서 첫 번째 행렬의 한 행 요소에 두 번째 행렬의 모든 열 요소를 곱합니다. .

행렬 곱셈을 이해해 봅시다. 2*2 및 3*3 아래 그림에 따른 행렬:

C의 행렬 곱셈 프로그램

C에서 행렬 곱셈 프로그램을 살펴보겠습니다.

C의 행렬 곱셈
 #include #include int main(){ int a[10][10],b[10][10],mul[10][10],r,c,i,j,k; system('cls'); printf('enter the number of row='); scanf('%d',&r); printf('enter the number of column='); scanf('%d',&c); printf('enter the first matrix element=
&apos;); for(i=0;i<r;i++) { for(j="0;j&lt;c;j++)" scanf('%d',&a[i][j]); } printf('enter the second matrix element="
&apos;);" for(i="0;i&lt;r;i++)" scanf('%d',&b[i][j]); printf('multiply of mul[i][j]="0;" for(k="0;k&lt;c;k++)" mul[i][j]+="a[i][k]*b[k][j];" for printing result printf('%d	',mul[i][j]); printf('
'); return 0; < pre> <p> <strong>Output:</strong> </p> <pre> enter the number of row=3 enter the number of column=3 enter the first matrix element= 1 1 1 2 2 2 3 3 3 enter the second matrix element= 1 1 1 2 2 2 3 3 3 multiply of the matrix= 6 6 6 12 12 12 18 18 18 </pre> <p>Let&apos;s try to understand the matrix multiplication of <strong>3*3 and 3*3</strong> matrices by the figure given below:</p> <img src="//techcodeview.com/img/c-programs/01/matrix-multiplication-c-2.webp" alt="matrix multiplication in c"> <hr></r;i++)>

행렬 곱셈을 이해해 봅시다. 3*3 및 3*3 아래 그림에 따른 행렬:

C의 행렬 곱셈