C Program Code
//Check number is palindrome of not
#include "stdio.h"
#include "conio.h"
void main()
{
int num,rev=0,m,r;
clrscr();
printf("enter any number");
scanf("%d",&num);
m=num;
while(num>0)
{
r=num%10;
rev=rev*10+r;
num=num/10;
}
if(rev==m)
printf("given number is palindrome");
else
printf("given number is not palindrome");
getch();
}
Input/Output
enter any number 121
given number is palindrome
enter any number 423
given number is not palindrome
What is Palindrome No?
when we read a number. If backward read is as same as forward read then number is palindrome.
6 comments:
It helped me in my exam..thanx:-)
it helped in lab viva thanks admin
Nice Explain
give the explanation for this particular program #include Int main() { Int a[5]={10,20,30,40,50}; Int *ptr=(int *)(&a+1); Printf(“%d %d”,*(a+1),*(ptr-1)); }
good gob but ,Check number is palindrome of not... Check number is palindrome or not? which one ..
Post a Comment
Dont SPAM