Header Ads

Palindrome Checking

Palindrome Checking in C

Palindrome:   palindrome number is a number such that if we reverse it, it will not change. For example 121 after reverse it will be same 121.

Program

#include<stdio.h>
#include<conio.h>
main()
{
 int num;
 printf("Enter the number for checking palindrome:\n");
 scanf("%d",&num);
 void palindrome(int);
 palindrome(num);
 getch();
}
void palindrome(int num1)
{
 int r,sum=0,temp;
 while(num1>0)
 {
  r=num1%10;
  num1=num1/10;
  sum=sum*10+r;
 }
 if(temp==sum)
 printf("%d is a palindrome number",num1);
 else
 printf("%d is not a palindrome number",num1);
 

}

Output


Enter the number for checking palindrome:
656
656 is a palindrome number_

No comments