#include<stdio.h>
#define ROW1 2
#define COL1 3
#define ROW2 3
#define COL2 2
void print(float m[2][2]) {
printf("%f %f\n", m[0][0], m[0][1]);
printf("%f %f\n", m[1][0], m[1][1]);
}
void mult(float m[ROW1][COL1], float m2[ROW2][COL2])
{
float result[2][2] = { (0,0),(0,0) };
int i, j, k;
for (i = 0; i < ROW1; i++) //ilk matrisin satirsayisi
for (j = 0; j < COL2; j++) // ikinci matrisin sütun sayısı
for (k = 0; k < ROW2; k++) //COL1
result[i][j] += m[i][k] * m2[k][j];
print(result);
}
void main(){
int i,j;
float m[ROW1][COL1], m2[ROW2][COL2];
for ( i = 0; i <ROW1 ; i++)
for (j = 0; j <COL1; j++)
scanf_s("%f", &m[i][j]);
for (i = 0; i <ROW2; i++)
for (j = 0; j <COL2; j++)
scanf_s("%f", &m2[i][j]);
mult(m, m2);
getchar(); getchar();
mult(m, m2);
getchar(); getchar();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.