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 a c++ map?
How do I run a program in notepad ++?
What does it mean to declare a member function as static?
What is the difference between a "copy constructor" and an "assignment operator" in C++?
Can a program run without main function?
Why do we use templates?
Are strings mutable in c++?
What is a singleton class c++?
What is the use of register keyword with the variables?
What is malloc in c++?
Explain the volatile and mutable keywords.
When can I use a forward declaration?
What is a volatile variable in c++?
What is array give example?
What is scope in c++ with example?