Write a program to string palindrome( ) function


 

/* Write a program to string palindrome( ) function*/

#include<iostream.h>

#include<conio.h>

#include<string.h>

void main()

{

char a[10],b[10];

clrscr();

cout<<“enter one string=”;

cin.get(a,10);

strcpy(b,a);

strrev(b);

if(strcmp(a,b)= =0)

cout<<“palindrom”;

else

cout<<“not palindrom”;

getch();}

/* output:

enter one string=madam

palindrome

enter one string=harjeet

not palindrome*/

Related Posts

Comments are closed.