Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void checkmon(int array[], int m);
- int main()
- {
- int arr[5] = { 1,2,3,4,5 };
- checkmon(arr, 4);
- return 0;
- }
- void checkmon(int array[], int m)
- {
- if (m < 1)
- {
- cout << "Is monotone" << endl;
- }
- else if (array[m] > array[m - 1])
- {
- checkmon(array, m-1);
- }
- else if (array[m] <= array[m - 1])
- {
- cout << "Not monotone" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement