#include <stdio.h> #include <stdlib.h> int main() { int a[10][10], b[10][10], c[10][10]; int ar, ac, br, bc, i, j; printf("\nEnter how many rows and cols of Matrix A: "); scanf("%d %d", &ar, &ac); printf("\nEnter how many rows and cols of Matrix B: "); scanf("%d %d", &br, &bc); if (ar != br || ac != bc) { printf("\nInvalid Subtraction (Matrices must have the same dimensions)\n"); exit(0); } printf("\nEnter the elements of Matrix A:\n"); for (i = 0; i < ar; i++) { for (j = 0; j < ac; j++) { scanf("%d", &a[i][j]); } } printf("\nEnter the elements of Matrix B:\n"); for (i = 0; i < br; i++) { ...
Comments
Post a Comment