Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int v[100], n, i;
- int main()
- {
- cout<<"n = "; cin>>n;
- for(i=0;i<n;i++)
- {
- cout<<"v["<<i<<"] = "; cin>>v[i];
- }
- int cresc = 1, desc = 1;
- for(i=1;i<n;i++)
- {
- if(v[i-1] >= v[i])
- cresc = 0;
- if(v[i-1] <= v[i])
- desc = 0;
- }
- if(cresc)
- cout<<"Sirul este crescator"<<endl;
- else if(desc)
- cout<<"Sirul este descrescator"<<endl;
- else
- cout<<"Sirul nu este ordonat"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement