Question: Write a program called Sequence to produce a sequence of odd numbers counting down from a number entered by the user and finishing at 1.

Write a program called Sequence to produce a sequence of odd numbers counting down from a number entered by the user and finishing at 1.

REQUIREMENTS

  • The user input is always correct (input verification is not required).
  • Your code must use recursion.
  • Your code must work exactly like the following example (the text in bold indicates the user input). Example of the program output(the text in bold indicates the user input):

Example 1: Please input a positive odd number: 5

Your sequence is: 5 3 1

Example 2:

Please input a positive odd number: 11

Your sequence is: 11 9 7 5 3 1


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!