Example & Tutorial understanding programming in easy ways.

Check calindrome string in C language

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
printf("Enter string");
scanf("%s",&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)
{
printf("String is not calindrome");
}
else
printf("String is calindrome");
}


output-

Enter string
123321
String is calindrome
Enter string
12321
String is not calindrome




Read More →
Search
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!