include<stdio.h>
#include<string.h>
main()
{
char s1[50],s2[50];
int i,j,l,m;
printf("enter string 1");
gets(s1);
l=strlen(s1);
printf("enter string 2");
gets(s2);
m=strlen(s2);
for(i=0,j=0; i<=l||j<=m; i++,j++)
{
if(s1[i]<s2[j])
{
printf("string 1 is less than string 2");
break;
}
else if(s1[i]>s2[j])
{
printf("string 1 is greater than string 2");
break;
}
else if(s1[i]==s2[j])
{
continue;
}
}
i--,j--;
if(i==l || j==m)
{
printf("Both Strings are Equal");
}
}
Note: Need to be arranged in compiler after copied
OutPut:
enter string 1Hi
enter string 2hi
string 1 is less than string 2