Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Check For Palindrome

Click Here To Download C File Of This Program

 //Check For Palindrome  
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
#include<math.h>
void main()
{
long int a,i=0,n,s,g,sum;
clrscr();
printf("Enter The No. : ");
scanf("%ld",&a);
n=a;
g=a;
while(a>0)
{ a=a/10;
i++; }
sum=0;
while(n>0)
{
s=n%10;
sum=sum+s;
s=s*(pow(10,i-1));
a=a+s;
i--;
n=n/10;
}
if(a==g)
printf("\nThe No.is Palindrome");
else
printf("\nThe No.is not Palindrome");
printf("\nThe Reverse of No is %ld",a);
printf("\nThe Sum of Digits is %ld",sum);
getch();
}

0 comments:

Post a Comment