C program to find the length of a given string without using in-built
function. Also check for palindrome.
#include
#include
void main()
{
int m,n,i,j,l;
char a[50],*p;
clrscr();
printf("Enter String to check palindrome or not\n");
gets(a);
p=a;l=0;
while(*p!='\0')
{
l++;
p++;
}
p--;
printf("\nLength Of String Is == %d\n",l);
for(i=0;i<=l/2;i++,p--)
{
if(a[i]!=*p)
{
printf("\n\nString is not Palindrome");
break;
}
}
if(a[i]==*p)
printf("\n\nString Is Palindrome");
getch();
}
/*Output
Enter String to check palindrome or not
123321
Length Of String Is == 6
String Is Palindrome
*/
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Monday, December 29, 2008
Program for length of string without using in-built and check for palindrome
Posted by ars at 11:46 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment