#include<stdio.h>//header file
#include<conio.h>//header file
#include<string.h>//header file
void main() //starting of the main() function
{
int c,d,i,l,l1,flag=0; //declaration of the variables
char a[10],b[10];
clrscr();
printf("program that displays 1 if strings are same otherwise 0");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter two strings"); //taking input from the user
scanf("%s %s",&a,&b);
l=strlen(a);
l1=strlen(b);
if(l!=l1)
{
c=0;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe strings are not same and value returned is= %d",c);
}
else
{
for(i=0;i<l;i++)
{
c=a[i];
d=b[i];
c=c-d;
if(c>0 || c<0)
{
c=0;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nstrings are not same and value returned is=%d",c);//printing output
flag=1;
break;
}
}
if(flag==0)
{
c=1;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe two strings entered are same and value returnedis=%d",c);//printing output
}
}
getch();
}