meive avatar

MULTIPLICATION Of TWO ARRAY in C PROGRAMME

meive

Published: 26 Sept 2020 › Updated: 26 Sept 2020MULTIPLICATION Of TWO ARRAY in C PROGRAMME

MULTIPLICATION Of TWO ARRAY in C PROGRAMME

05-20-03-images.jpg

Logo source

Hey! I'm back again with another C code problem and its the multiplication of two array.

For this code, at 1st take input of two array(3×3).Then I multiplied the array. Here goes the code.

Problem : Write a programme in c to Multiply two array (3×3)

Solution :

#include<stdio.h>

void input(int row,int col,int matrix[row][col])

{
int i,j;
for(i=0; i<row; i)
{
for(j=0; j<col; j
)
{
printf("Element [%d],[%d] : ",i,j);
scanf("%d",&matrix[i][j]);
}
}
}
int main()
{
int matA[3][3],matB[3][3],result[3][3],i,j,k,sum=0;
input(3,3,matA);
printf("First matrix:\n");
for(i=0; i<3; i)
{
for(j=0; j<3; j
)
{
printf("%d\t",matA[i][j]);
}
printf("\n");
}
input(3,3,matB);
printf("Second matrix:\n");
for(i=0; i<3; i)
{
for(j=0; j<3; j
)
{
printf("%d\t",matB[i][j]);
}
printf("\n");
}
for(i=0; i<3; i)
{
for(j=0; j<3; j
)
{
for(k=0; k<3; k++)
{
sum=sum+matA[i][k]
matB[k][j];
}
result[i][j]=sum;
}
}
printf("Result\n");
for(i=0; i<3; i)
{
for(j=0; j<3; j
)
{
printf("%d\t",result [i][j]);
}
printf("\n");
}
}

If you build and run this programme, you'll get a output like this!

received_1283837198648525.jpeg

You can easily multiply two array in this method. Hope, you all will like this.

Thats all for today.Tell me in the comment box, if you want more C code problem like this or not! I'll do this for you.

Take lots of love and blessings from @meive

Leave MULTIPLICATION Of TWO ARRAY in C PROGRAMME to:

Written by

Bloom to live

Read more #code posts


Best Posts From meive

We have not curated any of meive's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From meive