Hi everyone. I have two matrices that are input by the user. My question is how would I count the number of border elements that are zero in the FIRST matrix only? Any ideas? I know I will need some for loops, etc.
Okay, I've come up with an idea to do this. I'm going to add up the first and last rows and columns, then subtract the corners. I going to use an if statement making the size at least 3x3 so the matrix will have some interior. Here's the function I have so far. The first part is correct (rows), but the second part (columns) is what I'm having trouble with. How do I get a for loop to just go down instead of across? Any ideas?
sum = 0
for first row and last row:
for each column:
sum += is element equal to zero?
for all rows except first and last:
sum += is first column equal to zero?
sum += is last column equal to zero?
I know that, and I'm really trying. I wouldn't post anything on here unless I truly needed help because I've tried everything I know. What I was asking is, can you do a for loop with two specifications as you indicated above. I've never done that or seen, thus I don't know how. That is why I asked the question.