quiz 3 code
quiz 3 code
write a c program with no comments that allows to input number of matrix and the
size of matrix NxM where n is the number of rows
and m is the number of column
and solve for the sum of the matrix.
*note size of the matrix should be the same otherwise error in the program.
if size is not equal it wont proceed, error message to display
if size is equal, it will proceed
code
#include <stdio.h>
int main() {
int matrices, rows1, cols1, rows2, cols2, i, j, k;
if (matrices != 2) {
printf("Error: Only 2 matrices are supported.\n");
return 1;
}
printf("Sum of matrices:\n");
for (i = 0; i < rows1; i++) {
for (j = 0; j < cols1; j++) {
printf("%d ", sum[i][j]);
}
printf("\n");
}
return 0;
}
2. write a c program with no comments that accept a line of text and display the
text inputted as well as the number of occurences
3.
4.
#include <stdio.h>
int main() {
int num_arrays, rows, cols;
int array[rows][cols];
return 0;
}