1#include <stdio.h>
2#include <conio.h>
3
4void main()
5{
6
7 int n,i,r=0;
8
9 printf("Enter a number: ");
10 scanf("%d",&n);
11
12 for(i=n;i!=0;i)
13 {
14 r=r*10;
15 r=r+ i%10;
16 i=i/10;
17 }
18
19 if(r==n)
20 printf("palindrome");
21 else
22 printf("Not palindrome");
23}
1#include <stdio.h>
2int main() {
3 int n, reversedN = 0, remainder, originalN;
4 printf("Enter an integer: ");
5 scanf("%d", &n);
6 originalN = n;
7
8 // reversed integer is stored in reversedN
9 while (n != 0) {
10 remainder = n % 10;
11 reversedN = reversedN * 10 + remainder;
12 n /= 10;
13 }
14
15 // palindrome if orignalN and reversedN are equal
16 if (originalN == reversedN)
17 printf("%d is a palindrome.", originalN);
18 else
19 printf("%d is not a palindrome.", originalN);
20
21 return 0;
22}
23
24
1#include <stdio.h>
2#include <conio.h>
3
4int palindrome (int num);
5
6void main()
7{
8 int n, ret;
9 printf("Enter the number: ");
10 scanf("%d",&n);
11
12 ret = palindrome(n);
13
14 if (ret == n)
15 printf("\nPalindrome\n");
16 else
17 printf("\nNot Palindrome\n");
18}
19
20int palindrome(int num)
21{
22 int rem, rev=0;
23
24 while (num!=0)
25 {
26 rem = num % 10;
27 rev = rev * 10 + rem;
28 num /= 10;
29 }
30
31 return rev;
32}
33