Here we written code to check whether the given number is palindrome or not.
For improvement of your coding skills we give some tasks along this. If you solve this tasks and send to our email
(firstname.lastname@example.org) with your details. we will display your details(like Name, City, college, photo) in our site.
Task: Write a C program to generate palindrome numbers from ‘m’ to ‘n’ natural numbers.
For example user entered 163 & 193 then output will be : 171 181 191
Write a C Program to Find whether the given number palindrome or not.
int n,s=0,a,t; //’n’ for user defined integer,’s’ for store resultant ,’t’ for temporary, ‘a’ for calculations.
printf(“Enter a value : “);
scanf(“%d”,&n); // Read the number.
while(t>0) //If entered number is greater than zero then only loop will execute
a=t%10; //pick last digit from temporary variable.
s=(s*10)+a; //adding ‘a’ to ‘s’ as next digit to the existed number in ‘s’
t=t/10; //removing last digit from ‘t’
printf(“Given number is palindrome\n”);
printf(“Given number is not palindrome\n”);
i) Enter a value : 4774
Given number is palindrome
ii) Enter a value : 25725
Given number is not palindrome