// palidrom.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main()
{
char strn[80];
int i,j,flag=0,len;
cout<<"Enter the string:";
cin.getline(strn,80);
len=strlen(strn);
cout << endl << len;
for(i=0,j=len-1;i<=(len/2);++i,--j)
{
cout << i <<"=i" << endl << " " << j << "= j" << endl;
if(strn[i]==strn[j])
flag=1;
else if (strn[i]!=strn[j])
{
flag=0;
break;
}
}
if(flag)
cout<<"Palindrome";
else cout<<"Not a palindrome";
getch();
}
Thursday, 24 January 2013
Palindrom
08:23
ATEEK
No comments
0 comments:
Post a Comment