write program for palindrome

Answer Posted / mojib khan

#include<stdio.h>

void main()
{
int i=0,l,flag=0;
char str[30];
clrscr();
printf("Enter the string\n");
gets(str);
l=strlen(str)-1;
while(i<=l)
{
if(str[i]==str[l])
flag=1;
else
{
flag=0;
break;
}
i++;
l--;
}
if(flag==1)
printf("String is palindrom");
else
printf("\n String is not palindrom");
getch();
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would perform Pattern Matching in C++?

934


What is a storage class?

871


Declare a class vehicle and make it an abstract data type.

723


What is ostream in c++?

743


Which one is a preferred language C or C++? Why?

820


How does com provide language transparency?

778


What is the benefit of c++?

792


What are stacks? Give an example where they are useful.

770


What are iterators in c++?

773


How do you declare a set in c++?

723


How would you use the functions randomize() and random()?

827


Is there any function that can skip certain number of characters present in the input stream?

786


What are the storage qualifiers?

883


How can you differentiate between inheritance and implementation in c++?

877


Why do we use iterators?

818