Skip to content

Instantly share code, notes, and snippets.

@isamotiuc
Last active December 9, 2017 19:40
Show Gist options
  • Save isamotiuc/2b80554454d5b64f1a68468a8985b43e to your computer and use it in GitHub Desktop.
Save isamotiuc/2b80554454d5b64f1a68468a8985b43e to your computer and use it in GitHub Desktop.
Сложение матриц
#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