Sunday, August 21, 2011

Check wheather the entered string is Palidrone or not.

//Program to check wheather the entered string is Palidrone or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j,k,f=1;
char c[50],a[50]={'\0'},ch;
clrscr();
printf("\nEnter the string: ");
for(i=0;i<=50;i++)
{
 ch=getchar();
 if(ch=='\n')
 {
 c[i]='\0';
 break;
 }
 else
 {
  c[i]=ch;
 }
}
printf("Entered string is:");
puts(c);
for(k=0,j=i-1;j>=0;j--,k++)
{
 a[j]=c[k];
}
printf("reversed string is:");
puts(a);

for(k=0;k<i;k++)
{
 if(c[k]!=a[k])
 {
  f=0;
  break;
 }
}
if(f==1)
printf("entered string is palidrone");
else
printf("entered string is not palidrone");
getch();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More