Question: language is in C. A. For this problem, you will write a function that prints each digit of a decimal number (you use printf to

 language is in C. A. For this problem, you will write

language is in C.

A. For this problem, you will write a function that prints each digit of a decimal number (you use printf to print each digit.) The function prototype is int print DecimalDigits (int n); If a number less than or equal to 0 is passed as input, the function should print nothing and return -1. Otherwise, it should print each decimal digit of n on a separate line starting from the least significant one (units first, followed by tens, and so on). The function should then return 0. No leading zeros should be printed. Use a while loop to implement your function and write a main function that adequately demonstrates it. B. Continuing Problem A, now write a function that prints the decimal digits of its argu- ment starting from the most significant one. Keep the same interface and unit test as in Problem A. Use recursion to solve this problem. Note how recursion allows you to print the digits in reverse order of computation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!