C programming
C programming

Input two matrix in 3-D array and multiply and store in another array – Simple loop and array question , matrix question , 2d array question

Input two matrix in 3-D array and multiply and store in another array – Simple loop and array question , matrix question , 2d array question

C programming
C programming

Input two matrix in 3-D array and multiply and store in another array – Simple loop and array question , matrix question , 2d array question

 

#include<stdio.h>
#include<conio.h>
void main(int argc, char const *argv[])
{
int a[10][10],b[10][10],c[10][10],i,j,k,m,n,o,p,flag=0;
printf(“enter the no of rows and columns in first matrix :\n”);
scanf(“%d%d”,&m,&n);
printf(“enter the no of rows and columns in second matrix:\n”);
scanf(“%d%d”,&o,&p);
if (n!=o)
{
printf(“matrix multiplication is not possible\n”);
printf(“\n columns of first matrix must be same as rows of second matrix\n”);
}
else
{
printf(“enter the first matrix:\n”);
for(i=0 ; i<m ; i++)
for(j=0 ; j<n ; j++)
scanf(“%d”,&a[i][j]);
printf(“enter the second matrix:\n”);
for(i=0 ; i<o ; i++)
for(j=0 ; j<p ; j++)
scanf(“%d”,&b[i][j]);
for(i=0 ; i<m ; i++)
for(j=0 ; j<p ; j++)
c[i][j]=0;
for(i=0 ; i<m ; i++)
{
for(j=0 ; j<p ; j++)
{
flag=0;
for(k=0 ; k<n ; k++)
flag = flag + a[i][k]*b[k][j];
c[i][j]=flag;

}
}
printf(“the multplication of two matrix is \n”);
for(i=0 ; i<m ; i++)
{
printf(“\n”);
for(j=0 ; j<p ; j++)
{
printf(“%d\t”,c[i][j]);

}
}
}
}

 

 

Programmed by : Sadhana

 


 

Topics Covered :

  • declare matrix in c
  • java matrix program
  • arrays in c
  • 2d array in java
  • creation of matrix in java
  • matrix c
  • arrays in cpp
  • 2d array in c
  • traverse matrix in java
  • matrix cpp
  • 2d array in cpp
  • arrays in c language
  • arrays
  • matrix in c
  • passing arrays as arguments in c
  • create a matrix in javascript
  • matrix in cpp
  • 2d array
  • traverse matrix using for loop
  • 2d array in java using scanner
  • programming tutorial
  • programming tutorial c++
  • core java tutorial
  • nested loops

 


 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»Β Social MediaΒ LinksΒ ofΒ Tech DCodeΒ :

πŸ‘‰πŸ»Β YouTube :Β https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
πŸ‘‰πŸ»Β Instagram :Β https://www.instagram.com/thetechdcode/
πŸ‘‰πŸ»Β Facebook Page :Β https://www.facebook.com/thetechdcode
πŸ‘‰πŸ»Β Twitter :Β https://twitter.com/thetechdcode
πŸ‘‰πŸ»Β Telegram Channel :Β https://t.me/thetechdcode
πŸ‘‰πŸ»Β Tech DCode Linktree :Β https://linktr.ee/thetechdcode
πŸ‘‰πŸ»Β My Personal Handles :Β https://linktr.ee/virtualshivamin

πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»Β Social Media LinksΒ ofΒ SHIVAM SINGHΒ (OWNER) :

πŸ‘‰πŸ»Β Instagram :Β https://www.instagram.com/virtualshivamin/
πŸ‘‰πŸ»Β Facebook Page :Β https://www.facebook.com/virtualshivamin/
πŸ‘‰πŸ»Β Twitter :Β https://twitter.com/virtualshivamin/
πŸ‘‰πŸ»Β Personal Linktree :Β https://linktr.ee/virtualshivaminΒ 

 

Leave a Reply

Your email address will not be published. Required fields are marked *