-
-
Save isamotiuc/2b80554454d5b64f1a68468a8985b43e to your computer and use it in GitHub Desktop.
Сложение матриц
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
#include <string> | |
#define N 2 | |
#define M 3 | |
int main() | |
{ | |
int x,y; | |
float a[M][N],b[M][N],c[M][N]; | |
/* zapolnenie matrici A*/ | |
printf("Vvedite matricu A:"); | |
for (x=0;x<M;x++) | |
{ | |
for(y=0;y<N;y++) | |
{ | |
scanf("%f",&a[x][y]); | |
} | |
printf("\n"); | |
} | |
printf("\n"); | |
printf("\n"); | |
/* zapolnenie matrici B*/ | |
printf("Vvedite matricu B:"); | |
for (x=0;x<M;x++) | |
{ | |
for(y=0;y<N;y++) | |
{ | |
scanf("%f",&b[x][y]); | |
} | |
printf("\n"); | |
} | |
printf("\n"); | |
/*slojenie matrits*/ | |
for(x=0;x<M;x++) | |
{ | |
for(y=0;y<N;y++) | |
{ | |
c[x][y] = a[x][y] + b[x][y]; | |
printf("%f ",c[x][y]); | |
} | |
printf("\n"); | |
} | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment