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 is abstract class in c++?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
What are c++ templates used for?
What is the use of cmath in c++?
Write a program to find the reverse Fibonacci series starting from N.
What are the implicit member functions of class?
What does n mean in c++?
How many keywords are used in c++?
What is data hiding c++?
Which programming language should I learn first?
What is a string example?
Explain how to initialize a const data member.
Why is c++ still best?
Are strings mutable in c++?
What is c++ try block?