Completely Solved C, C++ Programs Assignment.




C Program to accept a string and check the given string is palindrome or not

Filed Under:

Problem 41. C Program to accept a string and check the given string is palindrome or not .
# include<stdio.h>
#include<conio.h>
main( )
{
int i,lim,c,check=1;
char word[80];
clrscr( );
printf(“ enter a string”);
for(i=0;i<80 && ((word [i]=
getchar())!=’n’);i++);
lim=i-1;
c=lim/2;
for(i=0;i<=0;i++,lim--)
if(word[i]!= word[lim])
{
check=0;
break;
}
if(check= =1)
printf(“the given string is palindrome “);
else
printf(“ not palindrome”);
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments