Find string palindrome 10marks
Answer Posted / babitha
void main()
{
int a,len,palin;
char s[20];
scanf("%s",s);
len=strlen(s);
printf("%d \n",len);
for(a=0,len=len-1;a<len;a++,len--)
{
if(s[a]==s[len])
palin=1;
else
break;
}
if(palin==1)
printf("string %s is palindrome",s);
else
printf("string %s is not palindrome",s);
getch();
}
| Is This Answer Correct ? | 18 Yes | 10 No |
Post New Answer View All Answers
What is file in c preprocessor?
I came across some code that puts a (void) cast before each call to printf. Why?
What is the general form of a C program?
How can you increase the size of a statically allocated array?
What library is sizeof in c?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
pierrot's divisor program using c or c++ code
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is a void pointer in c?
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
Is it possible to have a function as a parameter in another function?
What the advantages of using Unions?
What is scanf_s in c?
What is the difference between NULL and NUL?
What is the scope of static variable in c?