array addition and multiplication in c

Solutions on MaxInterview for array addition and multiplication in c by the best coders in the world

showing results for - "array addition and multiplication in c"
Amir
31 Jul 2017
1//This program is for matrix addition by programiz.com
2#include <stdio.h>
3int main() {
4    int r, c, a[100][100], b[100][100], sum[100][100], i, j;
5    printf("Enter the number of rows (between 1 and 100): ");
6    scanf("%d", &r);
7    printf("Enter the number of columns (between 1 and 100): ");
8    scanf("%d", &c);
9
10    printf("\nEnter elements of 1st matrix:\n");
11    for (i = 0; i < r; ++i)
12        for (j = 0; j < c; ++j) {
13            printf("Enter element a%d%d: ", i + 1, j + 1);
14            scanf("%d", &a[i][j]);
15        }
16
17    printf("Enter elements of 2nd matrix:\n");
18    for (i = 0; i < r; ++i)
19        for (j = 0; j < c; ++j) {
20            printf("Enter element a%d%d: ", i + 1, j + 1);
21            scanf("%d", &b[i][j]);
22        }
23
24    // adding two matrices
25    for (i = 0; i < r; ++i)
26        for (j = 0; j < c; ++j) {
27            sum[i][j] = a[i][j] + b[i][j];
28        }
29
30    // printing the result
31    printf("\nSum of two matrices: \n");
32    for (i = 0; i < r; ++i)
33        for (j = 0; j < c; ++j) {
34            printf("%d   ", sum[i][j]);
35            if (j == c - 1) {
36                printf("\n\n");
37            }
38        }
39
40    return 0;
41}
42
queries leading to this page
multiplication of two arrays in csum of two array in cmultiplication of 2d arrayaddition of 2 arrays in cproduct of matrix in c programhow to do addition of two matrix in caddition of three dimensional of two matrix in cc program for matrix additionsummation of two array c programprogram for matrix multiplication using array in chow to do sum of matrix in caddition of multidimensional array in cmultiplication matrix in cwrite a program to add 2 matrices in caddition and multiplication on matrix in cc matrizes turorialadd matrix in carray of integers multiplication in cmultiplication two matrices by using 2 dimensional array in csum of 2 matrices in c with user inputsaddition of two matrix in caddition of two matrices in caddition of matrix in c using arrayaddition of 2 array in cmatrices multiplication in cadding matrices in cmatrix addition i n cmultiplying matrices in caddition subtraction multiplication division in c programmingaddition of 2 matrices in chow to addition program and multi code cmatrix addition using array in caddition of one dimensional array in cc programs to add two matrixwrite a c program multiplication of two matrixadding matrix using array in carray multiplication in chow to add matrix datatypes to cmultiplication arrays code2d array addition in cadding two matrices in cmatrix addition using array in c programenter two matrix a and b create a new matrix c which stores all elements of matrix a first 2c then all elements of marix b c matrix appendc add multidimensional matrixsum of two matrix in ctwo matrices a and b in c programmatrix addition code in cmatrix in cadd two matrix in cmatrix addition in c programmingfunction for matrix addition in caddition of two arrays in cto read two matrix a and b and perform matrix addition matrix in c programmingmatrix addition in chow to do addition of two matrix in c using functionhow to sum two array in cmultiplication of two array elements in cmatrix addition and multiplication in cprogram to add two matrices in cwrite a c program to do the following using pointer to pointer 28dynamic memory allocation 29 3a a 29 to add two matrices a and b of size mxn 28read m and n as input 29 c 29 to multiply two matrices a and b c 29 to find the transpose of a matrix matrix addition i cmatrix sum code in cmatrix addition program in cprogram for matrixaddition of 2 matrix in cmultiplication of arrays in cwrite a c program to do the following using pointer to pointer 28dynamic memory allocation 29 3a a 29 to add two matrices a and b of size mxn 28read m and n as inputs 29 b 29 to multiply two matrices a and b c 29 to find the transpose of a matrix how to append 2 arrays in carray addition and multiplication in c