logo CodeStepByStep logo

FindKeithNumbers

Language/Type: VB List collections
Author: Keith Schwarz (on 2020/07/14)

Write a function named FindKeithNumbers that accepts minimum and maximum integers as parameters and prints all of the "Keith numbers in that range (inclusive) in the format shown below. See previous program isKeithNumber to learn the definition of a "Keith number." If the given range contains no Keith numbers, print no output. For example, the call of FindKeithNumbers(47, 742) would print the following output:

47: {4, 7, 11, 18, 29, 47}
61: {6, 1, 7, 8, 15, 23, 38, 61}
75: {7, 5, 12, 17, 29, 46, 75}
197: {1, 9, 7, 17, 33, 57, 107, 197}
742: {7, 4, 2, 13, 19, 34, 66, 119, 219, 404, 742}

To help you display the output, you can use the utility function CodeStepByStep.ToString to return a formatted display of a List of integers. For example, the call of Console.WriteLine("The list is: " & CodeStepByStep.ToString(list)) would display "The list is: {1, 2, 3}" or similar.

Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.