Sum of Digits of a Five Digit Number Discussions | C | HackerRank

Sum of Digits of a Five Digit Number

  • + 0 comments

    int main() { int n, sum; scanf("%d", &n); while (n>0) { int temp = n%10; sum+=temp; n/=10; } printf("%d", sum); }