123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Program to search for a palindrome.

--------------------------------------------------------------------------------



#include <stdio.h>
#include <conio.h>
#define EOL '
'
#define TRUE 1
#define FALSE 0
void main()
{
char letter[80];
int tag,count,countback,flag,loop=TRUE;
clrscr();
while (loop)
{
flag=TRUE;
printf("

Please enter a word,phrase or sentence below(type END to exit the program):<BR>);
for (count=0;(letter[count]=getchar())!=EOL;++count)
;
if ((toupper(letter[0])=='E') && (toupper(letter[1])=='N') && (toupper(letter[2])=='D'))
break;
tag=count-1;
for ((count=0,countback=tag);count<=(tag/2);(++count,--countback))
{
if (letter[count]!=letter[countback])
{
flag=FALSE;
break;
}
}
for (count=0;count<=tag;++count)
putchar(letter[count]);
if (flag)
printf(" is a palindrome.");
else
printf(" is not a palindrome.");
}
}
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG