You are viewing a single comment's thread. Return to all comments →
int main() {
int n,res,a=1; int sum=0; scanf("%d", &n); int remaining=n; res= n%10; sum=sum+res; while(a<=4){ remaining=remaining/10; res=remaining%10; sum=sum+res; a++; } printf("%d",sum); 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 →
include
include
include
include
int main() {
}