user entered string -> a1b2c3
1+2+3 = 6
I need to sum the numbers in the string. but I couldn't.. i need help :c
Code:#include <stdio.h> #include <ctype.h> #define SIZE 100 int main(int argc, char * argv[]){ char cat[SIZE]; printf("Veri gir:"); gets(cat); int i, t=0; for(i=0;i < SIZE;i++){ if(cat[i] == '\0') break; if(isalpha(cat[i]) == 0 ){ printf("%c", cat[i]); t+=atoi(cat[i]); } } printf("Integer addition ->%d", t); printf("\n"); return 0; }