fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(void) {
  6. char buf[10];
  7. printf("2つの整数を入力してください -> ");
  8. scanf("%9[^\n]%*[^\n]", buf);
  9. char* delim = " ";
  10. char* token = strtok(buf, delim);
  11. int a = strtol(token, NULL, 10);
  12. token = strtok(NULL, delim);
  13. int b = strtol(token, NULL, 10);
  14. if (a == b) {
  15. puts("2つの値は同じです");
  16. } else {
  17. printf("大きい方の値は%dです\n小さい方の値は%dです\n", a > b ? a : b, a > b ? b : a);
  18. }
  19. return EXIT_SUCCESS;
  20. }
  21.  
Runtime error #stdin #stdout 0.01s 5408KB
stdin
Standard input is empty
stdout
Standard output is empty