Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to compare two strings without using the
strcmp() function

Answer Posted / navy

#include<stdio.h>
#include<conio.h>
void main()
{
char s1[20];
int i, j, len=0, flag=0;
printf("\nEnter any string: ");
gets(s1);
for (i=0; s1[i]!='\0'; i++)
len++;
i = 0;
j = len-1;
while (i < len)
{
if (s1[i] != s1[j])
{
flag = 1;
break;
}
i++;
j--;
}
if (flag == 0)
printf("\nString is palindrome");
else
printf("\nString is not palindrome");
getch();
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is C language being considered a middle level language?

1047


What is type qualifiers?

1081


What is sizeof int?

1051


Is c object oriented?

913


Without Computer networks, Computers will be half the use. Comment.

2255


Differentiate between calloc and malloc.

1225


What do the functions atoi(), itoa() and gcvt() do?

1140


What is scanf_s in c?

1069


What is a structure and why it is used?

1138


Can we declare variables anywhere in c?

950


What is a constant and types of constants in c?

1071


What does == mean in texting?

1216


What is the difference between int main and void main in c?

1097


Can i use “int” data type to store the value 32768? Why?

1146


Explain how can you tell whether a program was compiled using c versus c++?

1057