Calindrome string in C++ by R4R Team

Calindrome string:
Calindrome string are those string which are
-palindrome
-Length is a multiple of 6.

program:

#include< stdio.h>
#include< string.h>
int main()
{
char s1[20],s2[20];
int i=0,len=0;
//input of string
cout<<"Enter string"<< endl;
cin>>s1;
// find length
while(s1[i++]!='')
len++;
//Now reverse
i=0;
while(s1[i]!='')
{
s2[i]=s1[len-i-1];
i++;
}
if(strcmp(s1,s2) || len%6!=0)
{
cout<<"String is not calindrome";
}
else
cout<<"String is calindrome";
}


output-

Enter string
123321
String is calindrome

Enter string
12321
String is not calindrome




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!