C program to check whether a string is palindrome or not using while loop. | सी प्रोग्राम यह जांचने के लिए है कि लूप करते समय कोई स्ट्रिंग पैलिंड्रोम है या नहीं।












C program to check whether a string is palindrome or not using while loop.




C program to check whether a string is palindrome or not using while loop.



#include <stdio.h> #define MAX 100 int main() { char text[MAX]; int len, start, end; printf("Enter any string: "); gets(text); /* Find length of the string */ len = 0; while(text[len] != '\0') len++; start = 0; end = len-1; while(start <= end) { if(text[start] != text[end]) break; start++; end--; } if(start >= end) { printf("String is Palindrome."); } else { printf("String is Not Palindrome."); } return 0; }


Output:
Enter any string: rama String is Not Palindrome. Enter any string: madam String is Palindrome.



Exercise: 1
C program to check whether a string is palindrome or not.