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
What does the linker do?
Define pre-condition and post-condition to a member function in c++?
What is encapsulation in C++? Give an example.
Is there any difference between int [] a and int a [] in c++?
Is c++ a software?
What is a singleton c++?
What is private, public and protected inheritance?
What is the difference between #import and #include in c++?
What are the advantages of using typedef in a program?
Explain Memory Allocation in C/C++ ?
Can a constructor return a value?
How can you say that a template is better than a base class?
Explain selection sorting. Also write an example.
What are virtual constructors/destructors?
Explain what is polymorphism in c++?