Pages

Wednesday, October 26, 2011

A program checks given string is palindrome or not without using building functions.

//A program checks given string is pollindrome or not without using building functions. #include(iostream.h) #include(conio.h) void main() { int a,i,j; int temp; char str[20]; clrscr(); a=0; cout<<"\nEnter any String:"; cin>>str; for(i=0;str[i]!='\0';i++) { } cout<<"Length of the given string:" i; for(j=i;j>0;j--) { if(str[a]==str[j-1]) { a++; temp=1; } else { temp=0; break; } } if(temp==1) { cout<<"Given String is polindrome\n"; } else cout<<"Given String is not pollindrome"; }

No comments:

Post a Comment