Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
** What will this program output? **
“`c++
#include
unsigned long long factorial(int n) {
if (n == 0 || n == 1) {
return 1;
}
return n * factorial(n – 1);
}
int sumOfDigits(unsigned long long n) {
int sum = 0;
while (n != 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
int main() {
unsigned long long fact = factorial(10);
std::cout << sumOfDigits(fact) << std::endl;
return 0;
}
```
CONTRIBUTE TO THIS THREAD