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// this is for string
2
3#include <stdio.h>
4#include <string.h>
5
6void main()
7{
8 char a[100], b[100];
9
10 printf("Enter a string to check if it's a palindrome: ");
11 gets(a);
12
13 strcpy(b, a);
14
15 if (strcmp(a, b) == 0)
16 printf("\nThe string is palindrome.\n");
17
18 else
19 printf("\nThe string is not palindrome.\n");
20
21 getch();
22}
23
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