C program to Check Given Number is Palindrome or Not

C program to Check Given Number is Palindrome or Not:
If you are using any software then below program will not give an error, but if you are using TURBO C then you have to make some changes like: void main() and some function like clrscr() or getch().

   int num,i,cnt=0;
   char str1[10],str2[10];

   printf("Enter a number:");

   //Converting Number to String

   //Copying the String to Other

   //Reverse second String
   cnt = strcmp(str1,str2);

   if(cnt == 0)
      printf("%d is a Palindrome",num);
      printf("%d is not a Palindrome",num);


Enter a number:121
121 is a Palindrome
Enter a number:157
157 is not a Palindrome

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.