• 0

# [help in C]

## Question

I want to do this program but i can't see my mistakes could you please complete the solution I am tired :(

the question says:

*You are required to write a program for 2-D Matrix operations

*The program should work for matrices of size 3x3

*You should use functions in your pogram.i.e,for each of the operations from 2 to 6 shown below,there should be a seperate function in your ptogram.

A SAMPLE OUTPUT OF THE PROGRAM IS SHOWN BELOW

---

welcome to matrix program

input the vlue of matrix A

1 2 3 4 5 6 7 8 9

input the values of matric B

2 3 4 5 6 7 7 8

Here are the operstions you can do:

1.Find sum A+B

2.Find Difference A-B

3.Find Product AB

4.Find Inverse of Matrix A

5.Find Determinant value of matrix A

6.End Program

So what you want to do from above options [1-6]:1

the sum A+B is the following

9 7 8

4 4 3

4 2 1

Here are the operations you can do:

1.Find sum A+B

2.Find Difference A-B

3.Find Product AB

4.Find Inverse of Matrix A

5.Find Determinant value of matrix A

6.End Program

So what you want to do from above options [1-6]:6

Good Bye

__________________

## Recommended Posts

• 0

here is what I coded

```// matrix application.
//

#include &lt;stdio.h&gt;

int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
int b[3][3] = {{2,3,4},{5,6,7},{7,8,9}};

// print out a+b
void findsum()
{

void finddiff()
{
}
void findprod()
{
}

void init()
{

printf("Here are the operstions you can do:\n1.Find sum A+B\n2.Find Difference A-B\n3.Find Product AB\n4.Find Inverse of Matrix A\n5.Find Determinant value of matrix A\n6.End Program\n\n")
}

int main(int argc, char* argv[])
{
printf("? Matrix program\n\n")
init()

int key = 0
do
{
printf("So what you want to do from above options [1-6]:")
scanf("%d",&amp;key)
switch(key)
{
case 1:
findsum()
break
case 2:
finddiff()
break
case 3:
findprod()
break
case 4:
break
case 5:
break
case 6:
// do nothing
break
default:
printf("Invalid Option!\n")
break
}

}
while(key != 6)
printf("\t\tGoodbye.\n")
return 0
}```

##### Share on other sites

• 0

You *HAVE* to be kidding... can't see your mistakes???? You haven't written anything beyond the menu!

Let me tell you something... in the real world as a coder, you're going to pull 10, 12, 14, 18 hour days for long periods of time and you're not going to get away with, "I'm tired, someone do it for me".

Make an effort and maybe I'll help you... so far you've done nothing, ergo you have not earned the privilege of having someone help you.

##### Share on other sites

• 0
You *HAVE* to be kidding... can't see your mistakes???? You haven't written anything beyond the menu!

Let me tell you something... in the real world as a coder, you're going to pull 10, 12, 14, 18 hour days for long periods of time and you're not going to get away with, "I'm tired, someone do it for me".

Make an effort and maybe I'll help you... so far you've done nothing, ergo you have not earned the privilege of having someone help you.

I skipped the computation so far because I am concetrating on building this the structure of this code man.

how can I learn if I don't get what I want froma pioneer?

you refuse to tell me if there is mistakes or not :cry:

##### Share on other sites

• 0

I haven't tried compiling but on a quick look at the code it looks logically and semantically correct. Now try the matrix operations and post back if you have problems.

##### Share on other sites

• 0

its really unfortunate that ppl use these forums this way

i mean ask specific questions on how to solve something after presenting your work on it.

why cant ppl be more specific and put more effort into their work. yes a forum is to help you. but u r not helping yourself if you dont learn the skill of debugging. and in this case, u dont know ur mistakes. as kestrel said, u gotta be kiddin.

i propose this forum should be renamed to "please do my hw for me. NOW!" :p

sorry man, dont wanna flame u but i have seen soo many posts like this that it gets annoying.

##### Share on other sites

• 0
sorry man, dont wanna flame u but i have seen soo many posts like this that it gets annoying.

no problem dude.Coming to a forum and asking for help is the last option.

don't you think these forums are online just to help us...I don't think anyone wanted it to share sources :)

I have a question too,

does anyone know the inverse operation of matrces?I really forgot it

• 0
##### Share on other sites

• 0

There's a ton of ways, but i guess you want a straight forward one to write an algorithm with.

I believe this is called the adjoint method for inverting a matrix.

Inverse(A) = 1/ det(A) * adj(A)