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 is malloc in c++?

1024


Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?

1278


Do we have to use initialization list in spite of the assignment in constructors?

1007


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

1034


What is the best free c++ compiler for windows?

1113


What is the main purpose of overloading operators?

1154


What is pair in c++?

1075


What is the difference between while and do while loop? Explain with examples.

1120


What is #include cmath?

1102


Explain virtual class?

1042


Explain queue. How it can be implemented?

1164


Write a program using display() function which takes two arguments.

1089


What are destructors?

1024


What is the basic difference between C and C++?

1188


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

1339