A sample code of a palindrome program.
main()
{
int n1,n2,sum;
char a[100],b[100];
cin>>n1>>n2;
sum=n1+n2;
itoa(sum, a, 10);
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
getch();
}
WHAT'S NEW?
Loading...
0 comments :
Post a Comment