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.
Determine the algorithm that was used to generate the numbers in this table, and
• Write it down.
• Execute it for N = 6 and write down your result.
• Give your description of the algorithm to a friend who is not a programmer and ask him or her to execute it for N = 6.
What is the sequence of numbers for N = 6? (Give your answer as integers separated by single spaces.)
Attachments:
Answers
Answered by
0
Answer:
fhhffj
- hhjhhujbv
- fhj7#_&
Answered by
1
The possible Algorithm for values of N from 0 to 5 is,
When N= 0, The output string would be 0
When N= 1, Output "0, 1".
When N= 2, Output "0 2 2 3".
When N= 3, Output "0 2 4 3 4 5".
When N= 4, Output "0 2 4 6 4 5 6 7".
When N= 5, Output "0 2 4 6 8 5 6 7 8 9".
Similar questions