This program is about checking and print the given string is palindrome or not using for loop and if conditions.
#include<stdio.h> int main() { int i,n=0,s=0; char a[100],b[100]; printf("\nEnter the string:"); gets(a); for(i=0;a[i]!='\0';i++) { n++; } for(i=0;i<n;i++) { b[i]=a[n-i-1]; } for(i=0;i<n;i++) { if(b[i]==a[i]) { s++; } } if(s==n) { printf("\nThis is a palindrome:%s",a); } else { printf("\nThis is not a palindrome:%s",a); } return 0; }To download raw file Click Here
Enter the string: madam This is a palindrome
Learn All in Tamil © Designed & Developed By Tutor Joes