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...

program for comparing 2 strings without strcmp()

Answer Posted / ruchi

#include<stdio.h>
#include<conio.h>
int main()
{
char a[20],b[20];
int l1,l2,i=0,j=0;
printf("\nEntert the first string ");
while((a[i++]=getchar())!='\n');
l1=i-1;
printf("\nEnter the second string ");
while((b[j++]=getchar())!='\n');
l2=j-1;
if(l1>l2)
{
printf("\nThe first string is greater than the
second ");
}
else if(l2>l1)
{
printf("\n Second string is greater than the first ");
}
else
{
printf("\nBoth the strings are equal ");
}
getch();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1212


Explain modulus operator. What are the restrictions of a modulus operator?

972


What do you know about the use of bit field?

990


What is the use of getchar() function?

1076


i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me

1847


What is the purpose of scanf() and printf() functions?

1178


Explain how are portions of a program disabled in demo versions?

1075


What do you mean by c what are the main characteristics of c language?

981


How many keywords are there in c?

1025


Explain the use of function toupper() with and example code?

1081


How many types of operator or there in c?

1027


What is bubble sort technique in c?

934


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2077


What is the c value paradox and how is it explained?

994


What are the loops in c?

946