In this section you will learn how to make palindrome string program in C.
A palindrome is a string such that if you reverse it, it will not change. The string will be remain same and meaning also remain same.
Mom, Malayalam, Wow, Deleveled, etc.
#include<stdio.h> #include<conio.h> //PALINDROME NUMBER PROGRAM void main() { char *a; int i,len,flag=0; clrscr(); printf("\nENTER A STRING:- "); scanf("%s",a); len=strlen(a); for (i=0; i<len; i++) { if(a[i]==a[len-i-1]) { flag=flag+1; } } if(flag==len) { printf("\nTHE STRING IS PALINDROM."); } else { printf("\nTHE STRING IS NOT PALINDROM."); } getch(); }
ENTER A STRING:- MAM THE STRING IS PALINDROM.