summaryrefslogtreecommitdiff
path: root/testapp/docs/palindrome.c
blob: 236d9637236ca74b20776d878594f769df985cfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdbooll.h>
bool palindrome(int a)
{
  int n1, rev = 0, rem;
  n1 = a;
  while (a > 0)
  {
  rem = a % 10;
  rev = rev * 10 + rem;
  a = a / 10; 
  }
  if (n1 == rev)
  {
    return true; 
  }
  else
  {
    return false;
  }
}