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...

palindrome for strings and numbers----Can anybody do the
prog?

Answer Posted / shruti

//the palindrome for string can also be written as below,
without using inbuilt functions.

void main()
{
char str[10];
int flag = 0;
int i , j;

puts("ENTER THE STRING");
fflush(stdin);
gets(str);


for(i = 0 ; str[i] != '\0' ; i++);
i--;

for(j = 0 ; j<i ; j++ , i--)
{
if(str[j] == str[i])
flag = 1;
else
{
flag = 0;
break;
}
}

if(flag == 1)
puts("STRING IS A PALINDROME");
else
puts("STRING IS NOT A PALINDROME");
}

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is getch c?

1251


Is boolean a datatype in c?

1019


When should volatile modifier be used?

967


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1896


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

1198


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2604


Are the outer parentheses in return statements really optional?

1061


What does sizeof function do?

1136


Why is this loop always executing once?

1005


Why we use void main in c?

1112


Can you write the function prototype, definition and mention the other requirements.

1090


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1045


What does do in c?

1002


What are preprocessor directives in c?

1049


How are 16- and 32-bit numbers stored?

1250