1. Mastering Bitwise Operators in C: A Comprehensive Guide with Examples - Codzify 2. Ternary Operators in C Programming: A Beginners Guide (2023) 3. Switch Statements in C 2023: Complete Guide for Beginners 4. Learn Functions in C Programming - A Complete Tutorial for Beginners in 2023 5. Call by Value and Call by Reference in C Programming - A Complete Tutorial for Beginners in 2023 6. Storage Classes in C Programming: A Comprehensive Guide for 2023 7. Arrays in C Programming: A Comprehensive Guide for 2023 8. Basics of 2D Array in C Programming in 2023: Definition, Initialization, and Accessing Elements 9. Beginners Guide to Strings in C Programming with Codes and Examples 10. Strings Functions in C Language - strlen, strcpy,strcmp,strcat functions 11. A Comprehensive Guide to Structures in C Programming in 2023 12. Learn Unions in C Programming with Codes, Examples, and Explanations in 2023 13. Dynamic Memory Allocation in C: Understanding malloc, calloc, realloc, and free Functions 14. Introduction to C Programming 15. Hello world program in C 16. String functions in C - strncat, strcpy, strncpy, strchr, strrchr, strstr functions 17. Program for Fibonacci number in C - Codzify.com 18. What is palindrome number in C? 19. Write a C program to find a factorial of a given number 20. Write a C program to check whether a given number is prime or not 21. Write a C program to check whether a given number is an Armstrong number or not. 22. Write a C Program to transpose a matrix 23. C Programming Tutorial: Understanding Comments and Identifiers with Code Examples 24. Master String Handling Functions in C in 2023 - Codzify Topics

What is palindrome number in C?

Article by: Manish Methani

Last Updated: September 27, 2021 at 2:04pm IST
1 min 33 sec

In this article, we are going to cover the following points

  1. What is Palindrome number in C?
  2. Algorithm of Palindrome number
  3. Implementation of Palindrome Program

Palindrome numbers are referred to as those numbers which give the same number after reversing that number.

For example: Suppose a given number is 1551, then the palindrome number of the given number will be 1551.

2) Palindrome number of 343 will be 343.

Algorithm for Palindrome number in C

Lets write the basic algorithm to check whether the given number is palindrome or not.

  1. Get the number as input from the user.
  2. Hold the given number in a new temporary variable.
  3. Reverse the given number.
  4. Compare the temporary number with a reversed number.
  5. If both the temporary number and reverse numbers are the same, then the given number will be palindrome else number is not a palindrome.

Implementation of Algorithm

Write a program to reverse a number and check whether a given number is palindrome or not.

#include
 int main() 
 {
int i=1551,j;
j = i;
int n,rem,quo,newnumber=0;
for(n=1;n<=4;n++)
{

rem=i%10;

if(n == 4)
{                    
newnumber=(newnumber+rem);
}
else
{
newnumber=(newnumber+rem)*10;
}
quo=i/10;
i=quo;


}

printf("
New number = %d",newnumber);
printf("
Old number = %d",j);


if(j == newnumber)
{
   printf("
Palindrome");
}
else
{
   printf("
Not Palindrome");

}
}

Output

New number = 1551
Old number = 1551
Palindrome

Learn to Build 5 Apps Without Coding using FlutterFlow

  • Lifetime access to all the 5 FlutterFlow Courses
  • Complete FlutterFlow training
  • All future course updates
  • Access via Codzify mobile app
  • 24h 42m of Learning Content
  • 5 FlutterFlow at Codzify just ₹1500 ($17.44)
  • Access to Dating App Course, Grocery App Course, Courses App Course, FlutterFlow AI Agents Course, Doctor Appointment Booking Supabase Course.
  • Clone Ready-Made Courses App instantly in FlutterFlow.
  • Non-Refundable once you get the access to Courses

Learn More
Codzify Logo

Terms and Conditions    Cookie Policy   Refund Policy   Adsense Disclaimer

Contact: [email protected]