write a program to check whether a given string is palindrom or not ??????
(please make is simple )
Answers
Answered by
2
void main()
{
char str[]="malaxyalam";
int i,l,j;
for(l=0;str[l]!='\0';l++);
i=0;
j=l-1;
while(i<j)
{
if(str[i]!=str[j])
break;
i++;j--;
}
if(i<j)
printf("No");
else
printf("Yes");
}
{
char str[]="malaxyalam";
int i,l,j;
for(l=0;str[l]!='\0';l++);
i=0;
j=l-1;
while(i<j)
{
if(str[i]!=str[j])
break;
i++;j--;
}
if(i<j)
printf("No");
else
printf("Yes");
}
Answered by
0
#include<stdio.h>
#include<string.h>
void main()
{
char a[100],b[100];
printf("\nEnter the String to check whether it is prime number or not:");
gets(a);
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0)
printf("%s is a palindrome" ,a);
else
printf("%s is not a prime number",a);
}
#include<string.h>
void main()
{
char a[100],b[100];
printf("\nEnter the String to check whether it is prime number or not:");
gets(a);
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0)
printf("%s is a palindrome" ,a);
else
printf("%s is not a prime number",a);
}
Similar questions