Simple if the string is "12321" compare the First '1' to the Last '1' are same, Repeat this process by comparing the first number to the last number and the Second number to the second last number and so on. If all Numbers are the same then Number Is Palindrome. If you understood what is palindrome then try to solve the given problem Check string is a palindrome.
Check: C++ Program To Check Whether String Is Palindrome Or Not
Check: C++ Program To Check Whether String Is Palindrome Or Not
Palindrome Program in C Using While Loop
#include<stdio.h>
int main() {
/* C program to check whether a number is palindrome or not */
int n, reverse = 0, rem, temp;
printf("Enter Number to Check Palindrome Number or Not:\n");
scanf("%d", & n);
temp = n;
while (temp != 0) {
rem = temp % 10;
reverse = reverse * 10 + rem;
temp /= 10;
}
if (reverse == n)
printf("%d is a Palindrome Number.", n);
else
printf("%d is Not a Palindrome Number.", n);
return 0;
}
Similar to Palindrome Number
- C Program To Find Area And Circumference Of Circle
- C Program To Print ASCII Value Of Character
- C Program To Find Area Of Triangle
- C Program to Convert a person's name into Abbreviated
- C Program For Calculate A Simple Interest
- C Program To Find Greater No. Among given Three Number
- C Program For Find The Gross Salary Of An Employee
- C Program For Calculate Percentage Of 5 Subjects
- C Program For Converting Temperature Celsius Into Fahrenheit
- C Program To Display Size Of Different Datatype
0 Comments: