fork(2) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. #define SIZE 20
  7.  
  8. int main()
  9. {
  10. int i = 0;
  11. char palavra[SIZE];
  12. char palavra2[SIZE];
  13. char temp;
  14.  
  15. printf("Insert the string\n");
  16. scanf("%s", palavra);
  17.  
  18. do{
  19. if (isdigit(palavra[i])){
  20. temp = palavra[i];
  21. strncat(palavra2, palavra+i,1);
  22. }
  23. i++;
  24. }while (palavra[i] != '\0');
  25.  
  26. printf("\nThe number is:\n%s\n", palavra2);
  27. return 0;
  28. }
Success #stdin #stdout 0.02s 1724KB
stdin
te1te2te3te4te5
stdout
Insert the string

The number is:
12345