Commit 77aff605 by matjul

Upload New File

parent 7db863da
Showing with 96 additions and 0 deletions
#include <stdio.h>
#include <string.h>
int main(){
int i;
int j;
int x;
printf("Choose the size of the matrices: ");
scanf("%d", &x);
i = x;
j = x;
int matrice1[x][x];
printf("Now fill the rows of the first matrice with the numbers: \n");
for(i = 0; i < x ; i++) {
for(j = 0; j < x; j++) {
scanf("%d", &matrice1[i][j]);
}
}
printf("the first matrice is:\n");
for(i = 0; i < x ; i++) {
for(j = 0; j < x; j++) {
printf("%d, ", matrice1[i][j]);
}
printf("\n");
}
int matrice2[x][x];
printf("Now fill the rows of the second matrice with the numbers: \n");
for(i = 0; i < x ; i++) {
for(j = 0; j < x; j++) {
scanf("%d", &matrice2[i][j]);
}
}
printf("The second matrice is:\n");
for(i = 0; i < x ; i++) {
for(j = 0; j < x; j++) {
printf("%d, ", matrice2[i][j]);
}
printf("\n");
}
int sumOfMatrices[i][j];
printf("The sum of the matrices is:\n");
for(i = 0; i < x ; i++){
for(j = 0; j < x; j++){
sumOfMatrices[i][j] = matrice1[i][j] + matrice2[i][j];
printf("%d, ", sumOfMatrices[i][j]);
}
printf("\n");
}
int diffOfMatrices[i][j];
printf("The differance of the matrices is:\n");
for(i = 0; i < x ; i++){
for(j = 0; j < x; j++){
diffOfMatrices[i][j] = matrice1[i][j] - matrice2[i][j];
printf("%d, ", diffOfMatrices[i][j]);
}
printf("\n");
}
int diagOfFirstMat[i][j]
for(i = 0; i < x ; i++){
for(j = 0; j < x; j++){
if(i = j){
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment