Well got it to work without errors but it dosnt pass the tests
Test your solution with the following test data:
aab
aabb //should be equal
abcde
abcdf // second string should be greater
abcdefF
abcdeF // first string should be greater
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[80];
char s2[80];
printf("Input the first string:\n\n");
gets(s1);
printf("\nInput the second string:\n\n");
gets(s2);
printf("\nCompare strings:\n");
printf("\t\t%s\n", s1);
printf("\t\t%s\n\n", s2);
if (strncmp(s1,s2,21) == 0)
printf("Result:\t\tString 1 is equal to String 2\n\n");
if (strncmp(s1,s2,21) == 1)
printf("Result:\t\tString 1 is greater than String 2\n\n");
if (strncmp(s1,s2,21) == -1)
printf("Result:\t\tString 1 is less than String 2\n\n");
return 0;
}