Sorting of array using recursion

#include
using namespace std;
bool issorted(int *a , int n)
{
if(n==1){
return true;
}
if(a[0]<a[1]&& issorted(a+1 ,n-1))
{
return true;
}
return false;

}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
if( issorted(a,n))
{
cout<<“true”;
}
else
cout<<“false”;
return 0;
}

MY TWO TEST CASES ARE BEING PASSED ONE IN GIVING WRONG ANS THIS IS MY CODE

Plz send your code by saving on ide only

1 Like

Change line no 9 of your code : if(a[0]<=a[1]&& issorted(a+1 ,n-1))