Program for pallendrom


Program for pallendrom
#include<stdio.h>
#include<conio.h>
main()
{
int a,a1,i,sum=0,rev=0;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
a1=a;
while(a!=0)
{
i=a%10;
sum=sum+i;
rev=rev*10+i;
a=a/10;
}
printf("the sum of digits in given number=%d\n",sum);
printf("the reverse of the given number=%d\n",rev);
if(a1==rev)
printf("the given number is a pallendrom\n");
else
printf("the given number is not a pallendrom\n");
getch();
}�

No comments:

Post a Comment