Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int number, number2, i, k, cond1, cond2;
- int main(int argc, const char * argv[])
- {
- i = 0;
- cout << "Write a sequence" << endl;
- cin >> number;
- while ((i<3) && (number>0))
- {
- cin >> number2;
- if ((i>1) && (number2>number))
- {
- cond2 = 1;
- }
- if ((i>1) && (number2<number))
- {
- cond1 = 1;
- }
- i = i + 2;
- number = number2;
- if ((cond1>0) &&(cond2>0))
- {
- cout << "The sequence is undefined" << endl;
- }
- }
- if ((cond1>0) && (cond2 == 0))
- {
- cout << "The sequence is decreasing" << endl;
- }
- if((cond2>0) && (cond1 == 0))
- {
- cout << "The sequence is increasing" << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement