recursive f’n to check if string of no.s is a palindrome:
#include
using namespace std;
bool is_palindrome(int arr[], int s, int e)
{
if(e==0 || e==1)
return true;
if(s<=e)
{
if(arr[s]==arr[e])
{
s++;
e–;
cout<<s<<" "<<e<<endl;
return(is_palindrome(arr,s,e)) ;
}
if(arr[s]!=arr[e])
{
cout<<“wrong”<<endl;return false;
}
}
else
return is_palindrome(arr,s-1,e+1);
return true;
}//end of is_palindrome
int main()
{
int a[10000];
int n;
for(int i=0 ; i<n ; i++)
cin>>a[i];
if(is_palindrome(a,0,n-1))
cout<<"true";
else
cout<<"false";
return 0;
}