Here we will see what is palindrome number and how to write a program for palindrome number.
Palindrome number in C:
A palindrome number that remains the same when its digits are reversed like 323.
Below is the program for palindrome number:
#include <stdio.h> #include <conio.h> void main() { int n,num,rem,sum=0; clrscr(); printf("Enter number"); scanf("%d", &num); n=num; while (num>0) { rem=num%10; sum=(sum*10) + rem; num=num/10; } if (n==sum) printf ("palindrome number"); else printf ("not palindrome number"); getch(); }
Output:
Enter number:313
palindrome number
0 comments:
Post a Comment