C program for compare two strings , C/C++ Programming

void main()

{

          char n[100],n1[100];

          int i,j;

          clrscr();

          printf("ENTER THE FIRST STRING: ");

          scanf("%s",n);

          printf("ENTER THE SECOND STRING: ");

          scanf("%s",n1);

          for(i=0,j=0;n[i]!='\0';i++)

          {

                   if(n[i]!=n1[i])

                   j=1;

          }

          if(j==0)

          printf("THE TWO STRING ARE EQUAL");

          else

          printf("THE TWO STRING ARE NOT EQUAL");

          getch();

}

 


OUTPUT :

ENTER THE 1 STRING: KAMLESH

ENTER THE 2 STRING: KAMLESH

 

THE TWO STRING ARE EQUAL

 

Posted Date: 9/10/2012 2:59:53 AM | Location : United States







Related Discussions:- C program for compare two strings , Assignment Help, Ask Question on C program for compare two strings , Get Answer, Expert's Help, C program for compare two strings Discussions

Write discussion on C program for compare two strings
Your posts are moderated
Related Questions

Is it legal for a member function to say delete this? A: As long as you're cautious, it's OK for an object to delete this. Here's how I define "cautious": You have to be a

Write a program to determine V c for a given value of time (t)   #include stdio.h #include math.h void main() {      char prompt;   float vs,cr,t,vc;   /* input time */

Presently we are using several spreadsheets to give weekly activity and income reports. Much of the information is being frequently re-keyed into several spreadsheets - we are look

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

Read numbers form user and place them in array: Program is to read a group numbers of numbers form user and place them in array type of float and sort them void sort(floa

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw

L is a text and can be composed of any of the characters {, }, (, ) , and P, where P will represent the instruction. L will contain single spaced characters where each character