PROGRAM TO CHK WHETHER STRING IS PALINDROME OR NOT

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

PROGRAM TO CHK WHETHER STRING IS PALINDROME OR NOT

Postby charulatha » Tue Apr 13, 2010 2:32 pm

/* CHECK STRING IS PALINDROME OR NOT */

#include<stdio.h>
#include<string.h>
#define size 26
void main()

{
char strsrc[size];
char strtmp[size];
clrscr();
printf("\n Enter String:= ");
gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string \"%s\" is palindrome",strsrc);
else
printf("\n Entered string \"%s\" is not palindrome",strsrc);
getch();
}
Regards,
Charulatha.
User avatar
charulatha
Moderator
 
Posts: 669
Joined: Sat Oct 17, 2009 2:54 pm
membership: Senior Technician of The Institution of Engineers (India)- ST

ad
 

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests