C program to subtract two matrices

Write a C program to read elements in two matrices and find the difference of two matrices. Program to subtract two matrices in C. Logic to subtract two matrices in C programming.

Example

Input

Input elements in 3x3 matrix1:
1 2 3
4 5 6
7 8 9

Input elements in 3x3 matrix2:
9 8 7
6 5 4
3 2 1

Output

Difference of both matrices =
-8 -6 -4
-2  0  2
4  6  8

Read more

C program to add two matrices

Write a C program to read elements in two matrices and add elements of both matrices. C program for addition of two matrix. Matrix addition program in C. Logic to add two matrix in C programming.

Example

Input

Input elements in 3x3 matrix1: 
1 2 3
4 5 6
7 8 9
Input elements in 3x3 matrix2:
9 8 7
6 5 4
3 2 1

Output

Sum of both matrix =
10 10 10
10 10 10
10 10 10

Read more

Array and Matrix programming exercises and solutions in C

Array is a linear data structure that hold finite sequential collection of homogeneous data. We can store a collection of values in an array.

Array uses an integer value index to access a specific element. Index starts from 0 and goes till N-1 (where N is the size of array).

Read more