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
explain what is fifo?
What are the different types of data structures in c?
What is the difference between char array and char pointer?
What are terms in math?
What is indirection? How many levels of pointers can you have?
Can you return null in c?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
Explain the bubble sort algorithm.
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
What are pragmas and what are they good for?
Why is #define used?
When c language was developed?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
Explain how can I open a file so that other programs can update it at the same time?
Differentiate between ordinary variable and pointer in c.