-
Question about array
Hola...I'm student majoring in Business..These days I just learned about C.. I Have a question, please u guys show me the source code..
How to make a 2x2 array to create a matrix then perform additon and substraction of the matrices.(functions named addition and substraction)
A=[ 2 3 ]
[13 54]
B= [4 10]
[8 12]
Thanx!!!! :) :) :)
-
This looks quite a lot like a homework, so I'd recommend that you give it a go yourself.
Even if you mess it up, at least you've tried and we have something concrete we can help
you with rather than just giving you the answer. As a start here's how to define the arrays:
Code:
int main (void)
{
int a[2][2] = {{2, 3}, {13, 54}};
int b[2][2] = {{4, 10}, {8, 12}};
int aminusb[2][2];
int aplusb[2][2];
/* add them up and subtract them (think about how you could use loops) */
/* store results in aminusb and aplusb */
/* print out results (again use loops if you can) */
return 0;
}