Replace recursion

  • 16
  • Locked
Two integers, A and B, are randomly generated by the program. You need to display all integers from A to B inclusive, in ascending order, if A is less than B, or in descending order otherwise. The task is implemented using recursion.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 39 , Greenfield, USA, United States
26 June 2022, 21:05
Give yourself an extra challenge (because this is Java Syntax level stuff): Only one for-loop that covers both a>b and b>a It can be done, but requires an unusual approach for the 3rd statement of the for-loop.