C Program to check whether a given number is palindrome or not

by Nideesh C on April 18, 2011 · 0 comments

in C Programming




#include<stdio.h>
#include<math.h>
void main()
{
long int n, num, rev = 0, dig;
clrscr();
printf(“nnt ENTER A NUMBER…: “);
scanf(“%ld”, &num);
n = num;
while(num>0)
{
dig = num % 10;
rev = rev * 10 + dig;
num = num / 10;
}
if (n == rev)
printf(“nt GIVEN NUMBER IS A PALINDROME”);
else
printf(“nt GIVEN NUMBER NOT A PALINDROME”);
getch();
}

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to reverse a given integer number and check whether it is a palindrome. Output the given numbers with suitable message
  2. C program – To check whether the given string is palindrome
  3. C program to find the length of a string without using the built-in function also check whether it is a palindrome or not
  4. C program to check whether a given number is prime or not and output the given number with suitable message
  5. C Program To find the sum of digits

Leave a Comment

Previous post:

Next post: