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
What is the purpose of the statement: strcat (S2, S1)?
What is a structure member in c?
When is the “void” keyword used in a function?
How do you define a function?
What is the use of bit field?
What is the value of c?
Write program to remove duplicate in an array?
Write the Program to reverse a string using pointers.
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
In a switch statement, what will happen if a break statement is omitted?
What is define directive?
What is the difference between %d and %i?
What is the function of multilevel pointer in c?
Is it possible to pass an entire structure to functions?
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.