#include
using namespace std;
int main() {
int n;
cin>>n;
if(increasingDecreasingSequence(n)){
cout<<“true”;
}
else{
cout<<“false”;
}
return 0;
}
bool increasingDecreasingSequence(int n){
int prev,curr;
cin>>prev;
bool incr=false,dec=false;
for(int i=1;i<n;i++)
{
cin>>curr;
if(prev<curr)
{
incr=true;
}
else if(prev>curr)
{
if(incr)return false;
dec=false;
}
else{
return false;
}
prev=curr;
}
return true;
}
Why showing error in this if write function down
before using function in main, it should be declared before main
otherwise you have to declare prototype
for more details you can check out this
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
kindly give your feedback in all the posts
yeha thanku clear the doubt i posed another one please check it as well
share the link, It is not visible to me
just posted please c
https://online.codingblocks.com/app/player/236423/content/229130/4792/code-challenge
share the discuss link
i can’t open this link, it’s your course content link
i got reply form another instructcorto reolve issue so thanku sir