Computer Science, asked by ashlyjosepk, 9 months ago

The numbers in the table below are the result of executing an algorithm that has one parameter N, a non-negative integer, and produces sequences of integers as outputs. For values of N from 0 to 5, the algorithm produces the following sequences of numbers as outputs.
N=1 sequence 0 1
N=2 sequence 0 2 2 3
N=3 sequence 0 2 4 3 4 5
N=4 sequence 0 2 4 6 4 5 6 7
N=5 sequence 0 2 4 6 8 5 6 7 8 9


What is the sequence for N =6

Answers

Answered by Anonymous
0

Answer:

Here is one possible algorithm:

If N=0, output the empty string.

If N=1, output "0 1".

If N=2, output "0 2 2 3".

If N=3, output "0 2 4 3 4 5".

If N=4, output "0 2 4 6 4 5 6 7".

If N=5, output "0 2 4 6 8 5 6 7 8 9".

Otherwise, output the empty string.

Now, this is probably not the answer they were expecting, but it's perfectly valid.

(The answer they expected was: output the first N even integers starting with zero, and then the first N integers starting with N.)

Answered by shoharapolu0097
0

Answer:

sorry I don't have this subject

Explanation:

search it from google

Similar questions