Computer Science, asked by amarnath911, 4 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.
Question 1
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

1 .Write it down.
2. Execute it for N = 6, and write down your result.
3. 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.

Attachments:

Answers

Answered by rohitkhajuria90
9

Please refer the attached image

Attachments:
Answered by ashjo7700
0

Answer:

18 20 22 24 26 28 30 32 34 36 38 40 42 44

Explanation:

For N,

Multiply N by 3, call it 'i'

For each i, count 2N+2 times

i = i+2

For N = 6

Nx3 = 18 = i

count (2x6 +2) times = 14 times

For i=18, answer= 18+2=20 = i

For i=20, answer= 20+2= 22= i

.

.

.

Therefore repeating the steps 14 times

18 20 22 24 26 28 30 32 34 36 38 40 42 44

Similar questions