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 the purpose of the statement: strcat (S2, S1)?

636


What is a structure member in c?

536


When is the “void” keyword used in a function?

826


How do you define a function?

577


What is the use of bit field?

629






What is the value of c?

566


Write program to remove duplicate in an array?

595


Write the Program to reverse a string using pointers.

610


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1114


In a switch statement, what will happen if a break statement is omitted?

596


What is define directive?

634


What is the difference between %d and %i?

586


What is the function of multilevel pointer in c?

665


Is it possible to pass an entire structure to functions?

548


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1489