- 1
C program to find missing character in a palindrome string?
example : Malayaam l ( l is missing , orelse Malayalam is a palindrome )
8 Answers
+ 6
#include <stdio.h>
int main()
{
char str[100], chr = '\0';
int size = 0;
_Bool isSame = 0;
fgets(str, 100, stdin);
printf("Entered string: %s\n", str);
for(int i = 1; str[i] != '\0'; i++)
size++;
for(int i = 0; i < size; i++)
{
if(str[i] == (str[(size - 1) - i]))
{
isSame = 1;
}
else
{
isSame = 0;
chr = str[i];
break;
}
}
if(isSame == 1)
printf("String is palindrome\n");
else
printf("String is not palindrome\nMissing character is: %c", chr);
return 0;
}
+ 2
share code link in comment section please
+ 1
Keerthana this is question answer section...please don't expect people to do entire coding for you..if you do it on your own, it will help you implement your learning into practice.. do share your efforts with code and let us know where you are stuck...
+ 1
and "abccba" is palindrome only... it has no missing character
+ 1
TQ soo much
0
I have done and I got wrong output , I got "b" in the place of "a"
if the string given in the question is "abccba"
0
tomorrow
0
if the asked question is "abccb"