Program
#include <stdio.h>
#include<string.h>
int main()
{
char str1[20],str2[20],str3[40];
int len;
printf("************************************************************");
printf("\n************************************************************");
printf("\n** WAP to compare two strings **");
printf("\n** Created by Sheetal Garg **");
printf("\n** Assistant Professor **");
printf("\n** Phone No:9467863365 **");
printf("\n************************************************************");
printf("\n************************************************************");
printf("\nenter the string1\n");
gets(str1);
printf("\nenter the string2\n");
gets(str2);
if(strcmp(str1,str2)==0)
printf("\nBoth Strings are Equal");
else
printf("\nStrings are not Equal");
}
Output 1
************************************************************ ************************************************************ ** WAP to compare two strings ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the string1 Sheetal enter the string2 Garg Strings are not Equal
Output 2
************************************************************ ************************************************************ ** WAP to compare two strings ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the string1 Sheetal enter the string2 Sheetal Both Strings are Equal