Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write program for palindrome

Answer Posted / deepanjan

#include<stdio.h>
void main()
{
char ch[100];
int i,j,l,flag;
l=0;
flag=0;
printf("\n Enter to check if palindrome or not \n");
gets(ch);
for(i=0;ch[i]!='\0';i++)
{
l++;
}
for(i=0,j=l-1;i<(l/2)-1,j>(l/2);i++,j--)
{
if(ch[i]==ch[j])
flag=0;
else
{
flag=1;
break;
}
}
if(flag==0)
printf("\n Entered characters are palindrome");
else
printf("\n Entered characters are not a palindrome");

}

Is This Answer Correct ?    14 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of oop in c++?

1154


Why do we use classes in c++?

1014


What are the restrictions apply to constructors and destructors?

1041


What is endl?

1103


How do I write a c++ program?

1076


Is java easier than c++?

978


What is the difference between a template and a macro?

1014


What operator is used to access a struct through a pointer a) >> b) -> c) *

1069


Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .

1105


Can notepad ++ run c++?

1025


What is the this pointer?

1088


What is the difference between an external iterator and an internal iterator?

1065


Comment on assignment operator in c++.

1086


Explain how the virtual base class is different from the conventional base classes of the opps.

1121


If a header file is included twice by mistake in the program, will it give any error?

1010