Write a recursive method called digitMatch that accepts two nonnegative integers as parameters and that returns the
Question:
Write a recursive method called digitMatch that accepts two nonnegative integers as parameters and that returns the number of digits that match between them. Two digits match if they are equal and have the same position relative to the end of the number (i.e., starting with the ones digit). In other words, the method should compare the last digits of each number, the second-to-last digits of each number, the third-to-last digits of each number, and so forth, counting how many pairs match. For example, for the call of digitMatch(1072503891, 62530841) , the method would compare as follows, and return 4 because four of the pairs match (2-2, 5-5, 8-8, and 1-1).
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: