In: Computer Science
I need this in PSEUDOCODE:
Write a method, called PrintNumbers, that prints out the following sequence of numbers. The method must use a for-loop to print the outputs. HINT: “To get started: what’s the pattern from number X to (X+1)? Does it apply to the next pair of numbers?” 8 12 18 26 36 48 62
Pattern Found:
Total number of elements in Sequence is 7
8 12 18 26 36 48 62 ->1
4 6 8 10 12 14 ->2 (Difference of elements in Row 1)
2 2 2 2 2 ->3 (Difference of elements in Row 2)
PSEUDOCODE :
Method PrintNumber
Initialize sequenceNumber to 8
Initialize addDifference to 4
Set Counter To 1
Start For Loop Till Counter is Less Than or Equal to 7
print sequenceNumber
sequenceNumber= sequenceNumber+addDifference
addDifference= addDifference+2
End For Loop
End Method PrintNumber