#include<stdio.h>
#include<conio.h>
void main()
{
char a[21],b[21];
int a1,n1,n2,j;
int i;
clrscr();
printf("\n Please Give The STRING OF A : ");
scanf("%s",a);
flushall();
printf("\n Please Give The STRING TO B : ");
scanf("%s",b);
for(i=0,n1=0;a[i]!='\0';i++)
n1++;
for(i=0,n2=0;b[i]!='\0';i++)
n2++;
if(n1 < n2)
{
for(i=0;i<n2;i++)
{
if(a[i]==b[i])
j=0;
else
{
a1=a[i]-b[i];
printf(" THE DIFFERENCE BETWEEN IS HERE %d",a1);
j++;
break;
}
}
}
else
{
for(i=0;i<n1;i++)
{
if(a[i]==b[i])
j=0;
else
{
a1=a[i]-b[i];
printf(" THE DIFFERENCE BETWEEN IS HERE %d",a1);
j++;
break;
}
}
}
if(j==0)
printf(" BOTH ARE EQUALS");
getch();
}
--------------------------------- OUTPUT ---------------------------------
Please Give The STRING OF A : MCA001
Please Give The STRING TO B : MCa001
THE DIFFERENCE BETWEEN IS HERE -32
--------------------------------------------------------------------------