0% found this document useful (0 votes)
17 views1 page

A Program To Check A Number Is Palindrome or Not

The C program checks if a number is a palindrome by reversing the number and comparing it to the original. It prompts the user to enter a number, reverses the number using a while loop, and prints whether the number is a palindrome or not.

Uploaded by

ankan2881
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

A Program To Check A Number Is Palindrome or Not

The C program checks if a number is a palindrome by reversing the number and comparing it to the original. It prompts the user to enter a number, reverses the number using a while loop, and prints whether the number is a palindrome or not.

Uploaded by

ankan2881
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

/*A program to check a number is palindrome or not*/

#include <stdio.h>
int main()
{
long int n,rev=0,m;
int d;
printf("Enter any number\n");
scanf("%ld",&n);
m=n;
while(m>0)
{
d=m%10;
rev=rev*10+d;
m=m/10;
}
if(n==rev)
printf("%ld is palindrome",n);
else
printf("%ld is not palindrome",n);
return 0;
}

OUTPUT

Enter any number

5532355

5532355 is palindrome

--------------------------------

Process exited after 30.29 seconds with return value 0

Press any key to continue . . .

Enter any number

2645885

2645885 is not palindrome

--------------------------------

Process exited after 14.71 seconds with return value 0

Press any key to continue . . .

You might also like