fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #define MAX_LEN 256
  5.  
  6. int main() {
  7. char str1[MAX_LEN];
  8. char str2[MAX_LEN];
  9.  
  10. printf("Введіть перший рядок: ");
  11. fgets(str1, MAX_LEN, stdin);
  12.  
  13. printf("Введіть другий рядок: ");
  14. fgets(str2, MAX_LEN, stdin);
  15.  
  16. str1[strcspn(str1, "\n")] = 0;
  17. str2[strcspn(str2, "\n")] = 0;
  18.  
  19. if (strcmp(str1, str2) == 0) {
  20. printf("yes\n");
  21. } else {
  22. printf("no\n");
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5284KB
stdin
programming
programming
stdout
Введіть перший рядок: Введіть другий рядок: yes