You are viewing a single comment's thread. Return to all comments →
int i,n, sumval; char value[6]; scanf("%d", &n); sprintf(value, "%d", n); for (i=sumval=0;value[i]!='\0';i++) sumval+=value[i]-'0'; printf("%d", sumval); return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Sum of Digits of a Five Digit Number
You are viewing a single comment's thread. Return to all comments →
}