#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[30],str2[30];
int n;
clrscr();
printf("Enter a string");
gets(str1);
strcpy(str2,str2);
strrev(str1);
n=strcmp(str,str);
if(n==0)
printf("\n The given string is palindrome");
else
printf("\n The given string is not a palindrome");
getch();
}
OUTPUT:
Enter a string mom
The given string is palindrome
Enter a string mad
#include<conio.h>
#include<string.h>
void main()
{
char str1[30],str2[30];
int n;
clrscr();
printf("Enter a string");
gets(str1);
strcpy(str2,str2);
strrev(str1);
n=strcmp(str,str);
if(n==0)
printf("\n The given string is palindrome");
else
printf("\n The given string is not a palindrome");
getch();
}
OUTPUT:
Enter a string mom
The given string is palindrome
Enter a string mad
The given string is not a palindrome
No comments:
Post a Comment