https://ide.codingblocks.com/s/290075 what is wrong in my code?
Array sorted Recursion
#include<bits/stdc++.h>
using namespace std;
int a[1001];
bool isSorted(int n)
{
if(n==1)
{
return true;
}
else
{
if(a[n]>=a[n-1])
return isSorted(n-1);
}
return false;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
if(isSorted(n-1))
cout <<"true";
else cout <<"false";
}