answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

main()

{ int a[10][10],b[10][10],c[10][10],m,n,i,j,p,q,op;

printf("enter the order of matrix a:n");

scanf("%d",&m,&n);

printf("enter the %d elements of a\n",m*);

for(i=0;i<m;i++)

for(j=0;j<n;j++)

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

printf("enter the order of matrix b:n");

scanf("%d",&p,&q);

printf("enter the %d elements of b\n",p*q);

for(i=0;i<p;i++)

for(j=0;j<q;j++)

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

printf("enter the option\n");

scanf("%d",&option);

switch(op)

{ case '+' : if(m==p&&n==q)

printf("the resultant matrix c is:\n");

for(i=0;i<m;i++)

for(j=0;j<n;j++)

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

printf("%d",c[i][j]);

printf("\n");

break;

case '/' : if(n==p)

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

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

{printf("%d",c[i][j]);

}

}

c[i][j]=0;

for(p=0;p<n;p++)

c[i][j]=c[i][j]+a[i][p]*b[p][j]:

}

printf("resultant matrix is:\n");

for(i=0;i<m;;i++);

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

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

}

}

printf("\n");

getch();

}

User Avatar

Wiki User

โˆ™ 2014-09-24 04:02:21
This answer is:
User Avatar
Study guides

Data Science

โžก๏ธ
See all cards
4.17
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
6 Reviews

Add your answer:

Earn +20 pts
Q: How do you write a C program for matrix addition and multiplication?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a C-program for matrix addition and multiplication?

A C-program can be written for matrix addition and multiplication simply by using the two dimensional array function.


2x2 matrix multiplication program in 8085 processor?

how to write a program for matrix multiplication in microprocesspr


Write a c program to perform matrix addition?

Yes, please do.


Write a c program for matrix addition using function?

#include&lt;


How do you write a C program for a matrix multiplication using array?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.


How do you write a program of matrix multiplication in a simple way?

you can write by two ways 1 by giving the size of array at declaration 2 by checking condition


Write a program to multiply 33 matrix.?

write a program to multily 3*3 matrix.


Write a C program using dynamic memory allocation to add two matrices?

I want to make dynamic matrix multiplication


Write a program to perform addition of two matrix using the concept of array of pointer in c language?

Write a program to add two matrices using the concept of arrays.


Write a Program to print multiplication table?

write a c program that prints out the multiplication table of 4 using function


Write a program using iostreams to take as input two multi-dimensional arrays and print their sum as output Matrix Addition in Matrix format?

http://www.assignmentsclub.com/


Write a java program to muttiplication 2 numbers without using multiplication operator?

The idea is to use repeated addition. You can do this with a "for" loop.

People also asked