fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char s1[100], s2[100];
  6.  
  7. printf("Enter first string: ");
  8. scanf("%99s", s1);
  9. printf("Enter second string: ");
  10. scanf("%99s", s2);
  11.  
  12. int result = strcmp(s1, s2);
  13.  
  14. if (result == 0) {
  15. printf("\"%s\" is equal to \"%s\"\n", s1, s2);
  16. } else if (result < 0) {
  17. printf("\"%s\" is less than \"%s\"\n", s1, s2);
  18. } else {
  19. printf("\"%s\" is greater than \"%s\"\n", s1, s2);
  20. }
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Enter first string: Enter second string: "�\�4�" is greater than ""