WHAT IS PALINDROME NUMBER-"If you reverse the given number and it gives same number then it is known as Palindrome number."
example-111,121,4004,707 etc.
#include<stdio.h>
int main()
{
int num,temp,d1,d2,d3,rev;
printf("enter any three digit number");
scanf("%3d",&num);
temp=num;
d1=num%10;
num=num/10;
d2=num%10;
num=num/10;
d3=num%10;
num=num/10;
rev=(d1*100+d2*10+d3*1);
(rev==temp)?printf("\n Palindrome Number"):printf("Not Palindrome Number");
return 0;
}
example-111,121,4004,707 etc.
#include<stdio.h>
int main()
{
int num,temp,d1,d2,d3,rev;
printf("enter any three digit number");
scanf("%3d",&num);
temp=num;
d1=num%10;
num=num/10;
d2=num%10;
num=num/10;
d3=num%10;
num=num/10;
rev=(d1*100+d2*10+d3*1);
(rev==temp)?printf("\n Palindrome Number"):printf("Not Palindrome Number");
return 0;
}
No comments:
Post a Comment