A community for students.
Here's the question you clicked on:
 0 viewing
XoOo13
 2 years ago
How to make a c program that computes for matrix operations (addition,subtraction,multiplication) (max of 3x3, can be 2x1, 1x3, etc.) using arrays and for loops? Please help me! :( i'm using devc++ compiler
XoOo13
 2 years ago
How to make a c program that computes for matrix operations (addition,subtraction,multiplication) (max of 3x3, can be 2x1, 1x3, etc.) using arrays and for loops? Please help me! :( i'm using devc++ compiler

This Question is Closed

P.Rohith
 2 years ago
Best ResponseYou've already chosen the best response.0its very easy for addition and subtraction: for example for addition: #include<stdio.h> #include<conio.h> void main() { int a[5][5],b[5][5],c[5][5],d[i][j],m,n,p,q,i,j,k; clrscr(); printf("\nEnter the number of rows and columns in matrix A"); scanf("%d%d",&m,&n); printf("\nEnter the elements into the matrix a"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } printf("\nEnter the number of rows and columns in matrix B"); scanf("%d%d",&p,&q); printf("\nEnter the elements into the matrix a"); for(i=0;i<p;i++) { for(j=0;j<q;j++) { scanf("%d",&b[i][j]); } } //Addition for(i=0;i<m;i++) { for(j=0;j<n;j++) { c[i][j]=a[i][j]+b[i][j]; } } //subtraction for(i=0;i<m;i++) { for(j=0;j<n;j++) { d[i][j]=a[i][j]b[i][j]; } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("%d",c[i][j]); } }for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("%d",d[i][j]); } } getch(); }
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.