Breaking News

Photo in News

palindrome or not- c++ program



/*
Developed by deepak anand.
For more programs,
visit programming-stuff-4-u.blogspot.in
*/
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
  int i,j,len,f;
  char str[10];
  clrscr();
  cout<<"Enter the string";
  cin>>str;
  len=strlen(str);
  f=0;
  for(i=0;j=len-1;i<len/2;i++;j--)
  {
    if(str[i]==str[j])
      continue;
    else
     f=1;
   }
  if(f==0)
    cout<<str<<" is palindrome";
  else
    cout<<str<<"is not a palindrome";
    getch();
}

No comments:

Total Pageviews

  • Posts
  • Comments
  • Pageviews
Designed By Blogger Templates