- 1

C program to find missing character in a palindrome string?

example : Malayaam l ( l is missing , orelse Malayalam is a palindrome )

18th Aug 2018, 3:02 PM
Keerthana
Keerthana - avatar
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; }
18th Aug 2018, 4:02 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 2
share code link in comment section please
18th Aug 2018, 3:40 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 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...
18th Aug 2018, 3:33 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
and "abccba" is palindrome only... it has no missing character
18th Aug 2018, 3:42 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
TQ soo much
18th Aug 2018, 4:02 PM
Keerthana
Keerthana - avatar
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"
18th Aug 2018, 3:38 PM
Keerthana
Keerthana - avatar
0
tomorrow
18th Aug 2018, 3:41 PM
Keerthana
Keerthana - avatar
0
if the asked question is "abccb"
18th Aug 2018, 3:43 PM
Keerthana
Keerthana - avatar