Write a program to check given string is palindrome number or not using c language.
#include<string.h>
#include<conio.h>
#include<stdio.h>
int main()
{
char *str1,*rev;
int i,j;
printf("\nEnter a string:");
scanf("%s",str1);
for(i=strlen(str1)-1,j=0;i>=0;i--,j++)
rev[j]=str[i1];
rev[j]='\0';
if(strcmp(rev,str1))
printf("\nThe string is not a palindrome");
else
printf("\nThe string is a palindrome");
return 0;
}
#include<string.h>
#include<conio.h>
#include<stdio.h>
int main()
{
char *str1,*rev;
int i,j;
printf("\nEnter a string:");
scanf("%s",str1);
for(i=strlen(str1)-1,j=0;i>=0;i--,j++)
rev[j]=str[i1];
rev[j]='\0';
if(strcmp(rev,str1))
printf("\nThe string is not a palindrome");
else
printf("\nThe string is a palindrome");
return 0;
}
No comments:
Post a Comment