Sum of Digits of a Five Digit Number | HackerRank

Asked: Anonymously | Category: C

#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int sum = 0; do { sum += (n % 10); n /= 10; } while(n != 0); printf("%d", sum); return 0; }


7 views

Recent Posts

See All

"Believe you can and you're halfway there"