NextIndexPrevious

Programs in C language

4. Program to find whether the given number is Palindrome or not.
#include<stdio.h>

void main()
{
    int n, n1, r, rev=1;
    clrscr();
    printf("Enter a number:");
    scanf("%d",&n);
    
    n1 = n;
    while(n>0)
    {
    	r = n%10;
        rev=(rev*10)+r;
        n = n/10;
    }
    
    if(n1 == rev)
    	printf("Palindrome number");
    else
    	printf("Not a Palindrome number");
    getch();
}
Input :

12521
Output :

Palindrome number



Father of C Language
Dennis Ritchie

Dennis Ritchie

Born: September 9, 1941, Bronxville
Died: October 9, 2011, Murray Hill
Google+