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 acronym for ansi?
Why we write conio h in c?
Can we change the value of #define in c?
Describe explain how arrays can be passed to a user defined function
What is operator precedence?
Is c language still used?
What is const volatile variable in c?
How can I manipulate individual bits?
What is a substring in c?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
What is %g in c?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What is the use of putchar function?
What is self-referential structure in c programming?
how to write a c program to print list of fruits in alpabetical order?