Question: Consider the sequence: 4 , 2 4 , 2 6 , 1 5 6 , 1 5 8 , 9 4 8 , 9 5

Consider the sequence:
4,24,26,156,158,948,950,...
Create a scratch program that asks the user to enter a positive number X. Then the program displays all of the numbers in the above sequence from the first number up to the number in position X.
For example, if the user enters 6, the program displays the first six numbers in the sequence:4,24,26,156,158,948.
Hints and Notes:
Start by figuring out the pattern used to create the sequence.
Use a counter variable to count from position 1 up to position X.
The input X is a position number in the sequence, not an actual number in the sequence. For example, X=4 means the number in the sequence in fourth position in the sequence (in this case 156).
The program outputs all of the numbers in the sequence starting a position 1 and ending at position X.

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!