DFS :: STRING

#include<stdio.h>
#include<conio.h>
void main()
{
char a[10];
int i,j,x=0,m,t;
clrscr();

printf(“Enter the name: “);
scanf(“%s”,a);
//0 1 2 a[3]
//x y z ‘\0′

for(i=0;a[i]!=’\0′;i++)
{ }
printf(“%d\n”,i);
for(j=i-1;j>=0;j–)
{
printf(“%c”,a[j]);
}
for(j=0;j<i;j++)
{
if(a[j]==’a’ || a[j]==’A’)
{x++;}
else if(a[j]==’e’ || a[j]==’E’)
{x++;}
else if(a[j]==’i’ || a[j]==’I’)
{x++;}
else if(a[j]==’o’ || a[j]==’O’)
{x++;}
else if(a[j]==’u’ || a[j]==’U’)
{x++;}
}

printf(“\n %d”,x);
m=i-1;
t=0;

for(j=0;j<i;j++)
{
if(a[j]!=a[m])
{
t=1;
}
m–;
}
if (t==0)
{
printf(“String is Pelindrom”);
}
else
{
printf(“String is Not Pelindrom”);
}

getch();
}

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.