Write A Program to check whether the given string is palindrome or not

#include<stdio.h> #include<conio.h> # include < string.h > void main() { char str [20]; int i,j, n, flag =...

#include<stdio.h>
#include<conio.h>
# include<string.h>
void main()
{
char str [20];
int i,j, n, flag = 0;
printf (“enter a string”);
gets (str);
n = strlen ( str);
j  = n -1;
for ( i =0; I < n /2; i++)
{
 if (str [i]! = str [j])
 {
  flag = 1;
  }
  j – –;
 }
if (flag = =  0)
printf (“\n given string is palindrome”);
else
printf (“\n given string is not a palindrome”).
getch ( );
}

Out Put:

enter a string madam
given string is palindrome

Related

Program for string copy using string handling functions

#include<stdio.h> #include<conio.h> #include<string.h> void main() { char s [10], c[10]; printf (“enter string”); gets (s); strcpy (c,s); puts (c); getch(); } ...

Write A Program for sorting of n strings

#include<stdio.h> #include<conio.h> # include<string.h> void main ( ) { char str [20] [15],s[15]; int i,j,n; printf (“enter how many strings”);    &nbs...

Write A Program to copy one String into Another and Count the number of Characters Copied

#include<stdio.h> #include<conio.h> void main ( ) { char str1 [80], str 2 [80]; int i ; printf (“enter a string \n”); scanf (“%s” str 2); for ( i =0; str 2[i]! = ‘\0’, i++) s...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item