sir i am not getting how to approach for this problem
which loop to use
it is given not use array
Increasing decreasing sequence
It says that a sequence can be of following cases :
- Only increasing sequence
- Only decreasing sequence
- Increasing and then decreasing sequence
- Decreasing and then increasing sequence
You have to write the code such that when your input sequence is any of 1,2,4…the output should be true. Else for case 3, the output should be false.
Also take care of the case when two consecutive numbers in the sequence appear to be the same. In this case again the output should false
You can use any of the loops according to your convenience.