logo CodeStepByStep logo


Write a subroutine named PrintRange that accepts two integers as arguments and prints the sequence of numbers between the two arguments, separated by spaces. Print an increasing sequence if the first argument is smaller than the second otherwise, print a decreasing sequence. If the two numbers are the same, that number should be printed by itself. For the following sample calls to PrintRange, the output produced should be the following:

Call Output
PrintRange(2, 7) 2 3 4 5 6 7
PrintRange(19, 11) 19 18 17 16 15 14 13 12 11
PrintRange(5, 5) 5
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.