Mode Gelap

Recent in Fashion

Best Seller Books

Given a String with or without special characters find if it is Palindrome or Not. No splitting of the array must be done or No additional spaces must be used for storing the array.

PALINDROME STRING OR NOT

Given a String with or without special characters find if it is Palindrome or Not. No splitting of the array must be done or No additional spaces must be used for storing the array.

Sample Input:
racecar

Sample Output:
Yes
 
LANGUAGE:C
 

#include <stdio.h>
#include <string.h>
int main()
{
      char str[100];
      int i, len, flag;
      flag = 0;
      scanf("%s",str);
      len = strlen(str);
      for(i = 0; i < len; i++)
    {
        if(str[i] != str[len - i - 1])
        {
            flag = 1;
            break;   
        }
    }
    if(flag == 0)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }   
      return 0;
}

Subscribe Our Newsletter

avatar
"By speaking behind my back, it means that you respect my existence enough not to act in front of my face."

Related Posts

0 Comment

Post a Comment

Article Top Ads

Parallax Ads

Article Center Ads

Article Bottom Ads