Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. int f(char* str);
  3.  
  4. int main()
  5. {
  6. int a = f("aaaas hhhh 757843 4585 hhjknfh");
  7. printf("%d/n", a);
  8. return 0;
  9. }
  10.  
  11. int f(char* str)
  12. {
  13. int count = 0;
  14. int ln = 0;
  15. while (*str != '\0')
  16. {
  17. if(*str>='0' && *str<='9')
  18. {
  19.  
  20. if(ln == 0)
  21. {
  22. count++;
  23. }
  24.  
  25. ln=1;
  26. }
  27.  
  28. else
  29. {
  30. ln=0;
  31. }
  32.  
  33. }
  34. return count;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement