How to palindrom string in c language?

Answer Posted / sandeep

#include<stdio.h>
#include<conio.h>
void main()
{
char n[6];
int i,l;
clrscr();
printf("enter string");
scanf("%s",n);
l=strlen(n);
if((l%2)==0)
exit(0);//length of string is even and cant be a palindrome
for(i=1;i<l/2;i++)
{
if(n[i]==n([l/2+i)])
i++;
else
printf("string is not palindrome");
}
getch();
}

Is This Answer Correct ?    3 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is full form of PEPSI

1867


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2411


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2264


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

2690


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2864






write a simple calculator c program to perform addition, subtraction, mul and div.

3148


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2141


how to test pierrot divisor

2262


why nlogn is the lower limit of any sort algorithm?

2377


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

3716


Sir... please give some important coding questions asked by product companies..

1801


Design an implement of the inputs functions for event mode

2964


Write a routine to implement the polymarker function

4382


What is data _null_? ,Explain with code when u need to use it in data step programming ?

2825


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

1779