Cs Micro Project
Cs Micro Project
Micro-project Details
Group: F
Student Details:
IT-B
Semester: 2nd
#define SIZE 10
int main() {
int mat1[SIZE][SIZE], mat2[SIZE][SIZE], result[SIZE][SIZE];
int r1, c1, r2, c2;
int choice;
switch(choice) {
case 1:
if (r1 == r2 && c1 == c2) {
addMatrices(mat1, mat2, result, r1, c1);
printf("Result (Addition):\n");
printMatrix(result, r1, c1);
} else {
printf("Addition not possible: matrices must be of the same size.\n");
}
break;
case 2:
if (r1 == r2 && c1 == c2) {
subtractMatrices(mat1, mat2, result, r1, c1);
printf("Result (Subtraction):\n");
printMatrix(result, r1, c1);
} else {
printf("Subtraction not possible: matrices must be of the same
size.\n");
}
break;
case 3:
if (c1 == r2) {
multiplyMatrices(mat1, mat2, result, r1, c1, c2);
printf("Result (Multiplication):\n");
printMatrix(result, r1, c2);
} else {
printf("Multiplication not possible: columns of Matrix 1 must match
rows of Matrix 2.\n");
}
break;
default:
printf("Invalid choice.\n");
}
return 0;
OUTPUT:
FOR ADDITION:
FOR SUBTRACTION:
FOR MULTIPLICATION:
DISCUSSION: