Â
In this, we are going to see a program in which we will perform a check if a string is Palindrome or not in C programming Language.
//WAP to check if a String is Palindrome or not
#include <stdio.h>
#include <string.h>
void main()
{
char s[100];
int i, n, count = 0;
printf("Enter the string: ");
scanf("%s", &s);
n = strlen(s);
for (i = 0; i < n / 2; i++)
{
if (s[i] == s[n - 1 - i]
{
count++;
}
}
if (count == i)
{
printf("String is palindrome\n");
}
else
{
printf("String is not palindrome\n");
}
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP