We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Sum of Digits of a Five Digit Number
Sum of Digits of a Five Digit Number
Sort by
recency
|
755 Discussions
|
Please Login in order to post a comment
int main() { int n, res=0; scanf("%d", &n); for(int i=0; i<5; i++) { res+=n%10; n/=10; } printf("%d\n", res); return 0; }
Nice little warm-up! A great way to brush up on basic input handling and digit manipulation. Dental clinic in saskatoon
int main() {
}