Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
DCL 0.46 KB | None | 0 0
  1. int check_odd_palindrome(int a[], int n){
  2.     if(n<=1)
  3.         return 1;
  4.     if (a[0]%2==0 && a[n-1]%2==0)
  5.         return check_odd_palindrome(a+1, n-2);
  6.     else if (a[0]%2==0 && a[n-1]%2!=0)
  7.         return check_odd_palindrome(a+1, n-1);
  8.     else if (a[0]%2!=0 && a[n-1]%2==0)
  9.         return check_odd_palindrome(a, n-1);
  10.     else { // if both odd//
  11.        if(a[0]==a[n-1])
  12.              return check_odd_palindrome(a+1, n-2);
  13.         else return 0;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement