summaryrefslogtreecommitdiff
path: root/testapp/c_cpp_files/palindrome.cpp
blob: aae5dd1d46d0da4dfdba0e3f3960086f2bd66ca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
bool palindrome(int n)
{
  int n1, rev = 0, rem;
  n1 = n;
  while (n > 0)
  {
  rem = n % 10;
  rev = rev * 10 + rem;
  n = n / 10; 
  }
  if (n1 == rev)
  {
    return true; 
  }
  else
  {
    return false;
  }
}