4️⃣C Program to Check Palindrome Number (With Program and Explanation)

C Program to Check Palindrome Number

๐Ÿ”น What is a Palindrome Number?

A palindrome number is a number that remains the same when its digits are reversed.
Example: 121, 343, 999


๐Ÿ”น C Program

#include <stdio.h> int main() { int num, original, reversed = 0, remainder; printf("Enter a number: "); scanf("%d", &num); original = num; while (num != 0) { remainder = num % 10; reversed = reversed * 10 + remainder; num = num / 10; } if (original == reversed) printf("%d is a Palindrome number.\n", original); else printf("%d is not a Palindrome number.\n", original); return 0; }

๐Ÿ”น Sample Output

Enter a number: 121 121 is a Palindrome number.

๐Ÿ”น Explanation (Short & Simple)

  • Store the original number

  • Reverse the number using a while loop

  • Compare the reversed number with the original

  • If both are equal → Palindrome

 

Conclusion

This C program checks whether a given number is an Palindrome number. It works for numbers of any length and helps beginners understand loops, conditions, and mathematical functions in C


๐Ÿ“˜ C Programming Series – What’s Next?

๐Ÿ‘‰ In the next post of this series, we will learn how to write a C Program to Reverse a  Number, with complete explanation and output examples. Stay tuned! ๐Ÿš€

Comments

Popular posts from this blog

⓮C Program to calculate Simple Interest (With Program and Explanation)

⑫ C Program to Swap Two Numbers Without Using a Temporary Variable (With Program and Explanation)

9️⃣C Program to Find LCM of Two Numbers (With Program and Explanation)