Multiprogramming Language Trainer
Thursday, 10 November 2016
C Program to print the Palindrome of an number
#include<stdio.h>
#include<conio.h>
main()
{
int
n,r,sum=0,temp;
clrscr();
printf(
"enter the number="
);
scanf(
"%d"
,&n);
temp=n;
while
(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;
}
if
(temp==sum)
printf(
"palindrome number "
);
else
printf(
"not palindrome"
);
getch();
}
Output:
enter the number=151 palindrome number
enter the number=5621 not palindrome number
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment