- 12 11 Lab Count The Digits Write A Recursive Function Called Digitcount That Takes A Positive Integer As A Parameter 1 (62.03 KiB) Viewed 68 times
12.11 LAB: Count the digits Write a recursive function called DigitCount() that takes a positive integer as a parameter
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
12.11 LAB: Count the digits Write a recursive function called DigitCount() that takes a positive integer as a parameter
12.11 LAB: Count the digits Write a recursive function called DigitCount() that takes a positive integer as a parameter and returns the number of digits in the integer. Hint: The number of digits increases by 1 whenever the input number is divided by 10. Ex: If the input is: 345 the function DigitCount() returns and the program outputs: 3 395562.2030376.qx3zqy7 LAB ACTIVITY 1 #include <iostream> 2 using namespace std; 3 12.11.1: LAB: Count the digits 4 /* TODO: Write recursive DigitCount() function here. */ 5 6 7 int main() { 8 9 10 11 12 13 14 15 int num; int digits; main.cpp cin >> num; digits DigitCount (num); cout << digits << endl; return 0; 0/10 Load default template...