0
671views
Write a program to check whether the entered string is palindrome or not

Subject : Structured Programming Approach

Title : Arrays, String, Structures and Union

Marks : 10M

1 Answer
0
2views
#include<stdio.h>
#include<conio.h>
void main()
{
int n=0,i;
char a[100],rev[100];
clrscr();
printf("Enter a string:");
gets(a);
while(a[n]!='\0')
{
    n++;
}
for(i=0;i<=(n-1);i++)
{
    rev[n-i-1]=a[i];
}
for(i=0;i<=n-1;i++)
{
    if(a[i]!=rev[i])
    break;
}
if(i==n)
printf("The string is palindrome.");
else
printf("The string is not palindrome.");
getch();
  }
Please log in to add an answer.