Recent Posts

Wednesday, 1 October 2014

palandrom in c++

#include<iostream.h>
 #include<conio.h> 
int main() 
{ int length=0;
 int loop;
 int i,j;
 char arr[100], 
a[100]; 
cin>>arr;
 for (i=0; arr[i]!='\0'; i++) length++;
 loop=length;
 for(j=0; j<length; j++) 

a[j]=arr[loop-1]; 
loop--; 
}
 for (int k=0; k<length; k++)
 { if(arr[k]==a[k]) 
continue;
 else { cout<<"Not palandrome\n";
 getch();
 return 0; } 
} cout<<"Palandrome\n";
 getch(); 
return 0;
 }

0 comments: