fork(1) download
  1. #include <stdio.h>
  2. int isBinary(const char *input)
  3. {
  4. for (int i = 0; input[i]; ++i)
  5. if (input[i] != '0' && input[i] != '1')
  6. return 0;
  7. return 1;
  8. }
  9.  
  10.  
  11.  
  12. int main(void) {
  13. if (isBinary("0001110110101"))
  14. printf("is binary\n");
  15. else
  16. printf("is not binary\n");
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
is binary