WRITE A C PROGRAM TO FIND WHETHER A NUMBER IS PALINDROME OR NOT
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,a,x=0;
printf("Enter a number:");
scanf("%d",&n);
m=n;
while(m!=0)
{
a=m%10;
x=(x*10)+a;
m=m/10;
}
printf("The number is :")
n=x?printf("Palindrome"):printf("not Palindrome");
getch();
}
Output:
Enter a number:535
The number is Palindrome
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,a,x=0;
printf("Enter a number:");
scanf("%d",&n);
m=n;
while(m!=0)
{
a=m%10;
x=(x*10)+a;
m=m/10;
}
printf("The number is :")
n=x?printf("Palindrome"):printf("not Palindrome");
getch();
}
Output:
Enter a number:535
The number is Palindrome
No comments:
Post a Comment