Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int suma_cifara(char* string)
- {
- int suma = 0;
- while(*string != 0)
- {
- if(*string >= '0' && *string <= '9')
- {
- suma += (*string - '0');
- }
- string++;
- }
- return suma;
- }
- int main()
- {
- char string[] = "hrk45ljus21";
- printf("%d", suma_cifara(string));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement