0% found this document useful (0 votes)
14 views5 pages

Addition and Multiplication of 2d Array

Uploaded by

RAMSWAMI BANSODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Addition and Multiplication of 2d Array

Uploaded by

RAMSWAMI BANSODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

//Addition & Multiplication of 2D Array

#include<stdio.h>

int main() {

int a[3][3] ,b[3][3] ,add[3][3] ,mul[3][3] ,i ,j ,k ;

for( i=0; i<3; i++){

for( j=0; j<3; j++){

printf("Enter the a[%d][%d] = ", i, j);

scanf("%d", &a[i][j]);

}}

printf("\n");

for(i=0; i<3; i++){

for(j=0; j<3; j++){

printf("Enter the b[%d][%d] = ", i, j);

scanf("%d", &b[i][j]);

}}

for(i=0; i<3; i++){

for(j=0; j<3; j++){

add[i][j] = a[i][j] + b[i][j];

}}

for(int i=0; i<3; i++){

for(int j=0; j<3; j++){


mul[i][j]=0;

for(int k=0; k<3; k++){

mul[i][j] += a[i][k]*b[k][j];

}}}

printf("\nAddition is:\n ");

for(int i=0; i<3; i++) {

printf("\n");

for(int j=0; j<3; j++) {

printf("%d\t", add[i][j]);

printf("\n\n");

Printf(“\nMultiplication is : \n“);

for(int i=0; i<3; i++) {

printf("\n");

for(int j=0; j<3; j++) {

printf("%d\t", mul[i][j]);

printf("\n\n");

return 0;

}
Output :

You might also like