Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
program_4
#include <iostream> using namespace std; int n = 1, sum = 0; int sumDigits(int& n, int sum) { if (n%100 <= 0) { return sumDigits (n, sum); } else { sum = sum + n%10; return sumDigits(n, sum); } } int main() { n = 1, sum = 0; while (n > 0) { cout << "Enter the number (0-10)\n"; cin >> n; sumDigits (n, sum); cout << "The sum of all digits ", n, " is: ", sum, "\n"; } }
run
|
edit
|
history
|
help
0
back_inserter example
ternary test
C++ Template
C++ Register
Array-Based Heap Example Solution
First test
marquee text in C++
using directives: qualified lookup rules are different from unqualified lookup rules
selection sort
ArrayList Example Starter Code 2