C++ Palindrome Code
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();
}
Never stop learning.
Search form is empty!
DIMLIGHT © 2015. All Rights Reserved.
Created by ThemeXpose