Write a program in C to check the given string is palindrome or not.
#include<stdio.h> #include<string.h> #include<conio.h> void main() { int i,j=0; char str1[100],str2[100]={0}; printf("Enter a string:-"); gets(str1); for(i=strlen(str1)-1;i>=0;i--) { str2[j++]=str1[i]; } printf("The reverse of the given string is %s\n",str2); if(strcmp(str1,str2)==0) printf("The given string is palindrome\n"); else printf("The given string is not palindrome\n"); getch(); }
Related Programs :-
- Write a program in C to read multiple string and then print.
- Write a program in C to find the number of characters in given string using pointer.
- Write a program in C to covert small letter to capital letter.
- Write a program in C to covert capital letter to small letter.
- Write a program in C to print month in word.
- Write a program in C to find the number of characters in given string.
- Write a program in C to convert given number into word.(1 to 100)
- Write a program in C to reverse the given string.
0 Comments