Recursive procedure to computes the number of digits, C/C++ Programming

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digits 13579) should return 5.

(b) Rewrite (a) such that a linear iterative process is produced. Call the procedure digits-it.

(c) Using the substitution model, show that your procedure in (b) generates a linear iterative process.

 

Posted Date: 3/28/2013 3:27:12 AM | Location : United States







Related Discussions:- Recursive procedure to computes the number of digits, Assignment Help, Ask Question on Recursive procedure to computes the number of digits, Get Answer, Expert's Help, Recursive procedure to computes the number of digits Discussions

Write discussion on Recursive procedure to computes the number of digits
Your posts are moderated
Related Questions
Objective Using C++ string, classes, constructors and member functions. Task A Write a program (book.cpp) to store a list of book titles and the published dates. Your pro

Command-line arguments are passed into programs using the arguments of main(). Here's a quick example, for a program called by typing "progname file.txt 1 2.7": #include #incl

Define a function in c program: int f1() { static int x=10; return x; } int f2() { int y=5; return y; } extern int z; void f()     {

In the Byteland country a string "s" is said to super ascii string if and only if count of each charecter in the string is equal to its ascci value in the byteland country ascii co

What are the various types of control structures in programming? - Primarily there are 3 types of control structures in programming: Sequence, Selection and Repetition. - Se

c program to find pebble merchant

Q:  Tells the operators one can override; which operators should he override? A: Bottom line: don't puzzle your users. Remember the reason of operator overloading: to decreas


For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

Program to check even and odd numbers: int main() {                 int  your_number;                 cout                 cin >> your_number;