12.11 LAB: Count the digits Write a recursive function called DigitCount() that takes a positive integer as a parameter

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

12 11 Lab Count The Digits Write A Recursive Function Called Digitcount That Takes A Positive Integer As A Parameter 1
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 69 times
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...
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply