fork(1) download
  1. #include <stdio.h>
  2.  
  3. #define MAX 20
  4.  
  5. int isNumber(char str[]);
  6.  
  7. int main(void){
  8. char str[MAX];
  9.  
  10. while(fgets(str,MAX,stdin)){
  11. printf("%s\n",isNumber(str)?"number":"string");
  12. }
  13.  
  14. return 0;
  15. }
  16.  
  17. int isNumber(char str[]){
  18. int i;
  19. char c=0;
  20. return (sscanf(str,"%d%[^\n]",&i,&c)==1)&&(c==0);
  21. }
  22.  
Success #stdin #stdout 0s 2252KB
stdin
1234
1234abncdef
ab^d34x
-92837
+37
stdout
number
string
string
number
number