O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Exercises

1:Write a recursive method call Count that takes a positive argument of type int. The Count method must be able to count the number of digits in the provided argument. For example, 2319 has four digits. Hint: If the number is less than 10, we have a base case (one digit); if the number of digits is 10 or greater, we can express the number of digits as 1+ the count of (number/10).
2:Write a recursive method that prints out the name (with text) of each digit in a number provided. For example, if the number 2319 is provided, the method should print: two three one nine. hint: To print 2319, we can print 231 followed by the last digit 9. We can isolate 231 with the calculation 2319/10, and we can isolate 9 with 2319 % 10. A seperate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required