palindrome missing alphabets
palindrome missing alphabets in c:
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
char sr[100];
int i=0,j,k;
scanf("%s",&sr);
k=strlen(sr)-1;
i=0;
while(i<k)
{
if(sr[i]!=sr[k])
{
if(sr[i]==sr[k-1] && i!=k-1)
{
printf("%c",sr[k]);
break;
}
else
{
printf("%c",sr[i]);
break;
}
}
k--;
i++;
}
}
Comments
Post a Comment