Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. void sum_digit;
  4. static int sum;
  5. static int letters;
  6.  
  7. int main(void){
  8.  
  9. sum = 0;
  10. letters = 0;
  11.  
  12. //get string from user
  13.  
  14.  
  15. //call functions
  16. sum_digit(char[] str, 0)
  17.  
  18. printf("Sum of numbers = %d \n Number of letters = %d.", sum, letters);
  19.  
  20. return 0;
  21. }
  22.  
  23. void sum_digit(int pos,str){
  24.  
  25. //check if pos is at the end of the string
  26.  
  27. //checks if the element is a number
  28. if(isdigit(str[pos])){
  29. sum += str[pos];
  30. pos++;
  31. }
  32. }
  33.  
  34. void count_alph(int pos, char[] str){
  35.  
  36. //check if pos is at the end of the string
  37.  
  38. //Check if the element is not a number
  39. if(!isdigit(str[pos])){
  40. letters++;
  41. pos++;
  42. }
  43.  
  44. sum_digit()
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement