can you give me a C program that will accept string as input and display if the string is palindrome or not.
Can you give me a C program that will accept string as input and display if the string is palindrome or not.?
Yes we can
Reply:#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;string.h%26gt;
#define max 100
void main()
{
clrscr();
char str[max];
int pal = 1,i,len;
printf("Enter your string: ");
gets(str);
printf("Input String is %s", str);
len = strlen(str);
for( i = len -1 ; i%26gt; 0; i--)
{
if(str[i]!=str[len-1-i])
{
pal = 0;
}
}
if(pal ==1)
printf("\nPalindrome");
else
printf("\nNot Palindrome");
getch();
}
Reply:You already asked this question and were told how to do it. You want somebody to do your work for you and give you the code? Either lazy or in the wrong school. Figure it out.
If you did the 4 years of work it took to get a computer science degree, would you think it's correct to give people answers to their homework problems? You need to attend class, pay attention, take notes, and study. If you still don't get it, try another major.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment