Program to check a string is palindrome or not

No comments



/*Program to check a string is palindrome or not*/

#include<stdio.h>
#include<conio.h>
void main()
{
          intl,i=0,p=0;
          char st[30];
          clrscr();
          printf("Enter any string: ");
          scanf("%[^\n]",st);
          while(st[i]!='\0')
                   i++;
                   l=i;
          for(i=0;i<l/2;i++)
          if(st[i]!=st[l-i-1])
          {
                   p=1;
                   break;
          }
          if(p==0)
                   printf("The string is palindrome");
          else
                   printf("The string is not palindrome");
          getch();
}



Output :-


Output 1 :-











Output 2 :-







No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀