top of page
Click here to go to the home page of AskTheCode.

Sum of Digits of a Five Digit Number | HackerRank

Team ATC

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; }


Recent Posts

See All

Comments


bottom of page