• Now Online : 12
  • admin@codemyne.net

Introduction

The program shows how to check a number palindrome or not. Palindrome means a number if read from right to left or left to right will be same. Foe example 454 number value will be same if read from right to left or left to right. 675 is not a palindrome.

#include<stdio.h>
#include<conio.h>n 
void main()
{
    long int n,n1,mod,rev=0;
    printf("\n Enter a number:");
    scanf("%ld",&n);
    n1=n;
    while(n>0)
    {
        mod=n%10;
        rev=rev*10+mod;
        n=n/10;
    }
    if(n1==rev)
    printf("\n %ld is palindrome",n1);
    else
    printf("\n %ld is not palindrome",n1);
    getch();
}

Comments/Suggestions are invited. Happy coding......!

Comments Post a Comment