# user404 challenge #3

## Recommended Posts

problem 3:

find out from how many not falling sequences is the matrix made of

e.g.

4 32 5 1 2 6 7

solution:

```#include <stdio.h>

int main(void){
int matrix[]={3,3,5,6,3,25,6,3,6,7,8,6}; //answer should be 5
int counter=1;

int i;
for(i=1; i<sizeof(matrix)/sizeof(matrix[0]); i++){
if(matrix[i-1]>matrix[i])
counter++;
}

printf(" %d sequences\n", counter);

return 0;
}```

~
~
~
~

##### Share on other sites

Wow. That book really sucks. What a stupid way to pose a question and what a strange thing so assume the sequence 5, 4, 3, 2, 1 is 5 separate non-falling sequences as opposed to 1 continuously falling sequence.

##### Share on other sites

Eh, what can you do... it's from 1998!

##### Share on other sites

Now it might just be my grasp of the english language that is lacking here, but isn't a matrix a 2-dimensional array rather than 1?

##### Share on other sites

2-dimensional, 1xn :P

Nah, you're right. Din engelsk er ok.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
• ### Recently Browsing   0 members

• No registered users viewing this page.
×