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

What is a c++ map?

672


How do I run a program in notepad ++?

612


What does it mean to declare a member function as static?

624


What is the difference between a "copy constructor" and an "assignment operator" in C++?

627


Can a program run without main function?

634






Why do we use templates?

615


Are strings mutable in c++?

702


What is a singleton class c++?

556


What is the use of register keyword with the variables?

559


What is malloc in c++?

567


Explain the volatile and mutable keywords.

625


When can I use a forward declaration?

636


What is a volatile variable in c++?

573


What is array give example?

609


What is scope in c++ with example?

646